I have a .gitignore
file in the wwwroot
folder of my project that I am trying to exclude from being published. The following code does not seem to work:
<ItemGroup>
<Content Include="wwwroot\.gitignore">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
When I publish the project using the dotnet publish
command, the .gitignore
file is still found in the output directory.
You have to use Update
like so:
<Content Update="wwwroot\.gitignore">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>