Reputation: 903
I have an SDK style csproj file with three items that I need copied into the output. I modified the .csproj file as follows
<ItemGroup>
<None Update="Impls\SilSidePane\whitepixel.bmp" CopyToOutputDirectory="Always" />
<None Update="Impls\SilSidePane\DefaultIcon.ico" CopyToOutputDirectory="Always" />
<None Update="Controls\XMLViews\Resources\TextCacheModel_LanguageExplorer.xml" CopyToOutputDirectory="Always" />
</ItemGroup>
The first two files were copied, but the third wasn't with no information in the logs as to why.
If I instead do the following then the file is copied.
<ItemGroup>
<None Remove="Controls\XMLViews\Resources\TextCacheModel_LanguageExplorer.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Controls\XMLViews\Resources\TextCacheModel_LanguageExplorer.xml" CopyToOutputDirectory="Always"/>
</ItemGroup>
Can someone explain this different behavior?
Upvotes: 1
Views: 1109
Reputation: 100611
Depeding on which SDK you're using, None
may not be the default item that the xml file is added as.
For example, if TextCacheModel_LanguageExplorer.xml
is an EmbeddedResource
, then you need to use <EmbeddedResource Update="..." .../>
instead.
Same goes for Content
items (e.g. top-level json files in ASP.NET Core applications)
Upvotes: 1