dotnet publish ignores CopyToOutputDirectory option

  • Thread starter Thread starter Vasoli
  • Start date Start date
V

Vasoli

Guest
I want to bundle only specific appsettings.Configuration.json file while building a project. In csproj file I added following lines:

</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'">
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Debug.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Configuration1.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Configuration2.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>

<Content Update="appsettings.Release.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

</ItemGroup>
I was expecting to see only appsettings.Release.json in final artifact, but instead I see all files there. How can I fix this in MS pipeline process?

Continue reading...
 
Back
Top