Reputation: 10163
I'm working on a C# project that has Content files. In MonoDevelop, I can set the type to Content
and the Build Action
to Copy if Newer
. I can do something similar in Visual Studio.
How do I do this with Visual Studio Code? I'm not opening a solution file (I'm opening a directory), and I don't see anything in tasks.json
or in VSCode that I can use to configure this.
Upvotes: 12
Views: 11673
Reputation: 372
Updating the .csproj file with the below line of code helped me
<ItemGroup>
<Content Include="FolderPath/*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
Upvotes: 11
Reputation: 595
This is a direct code if you want to include an appsettings.json in the output directory. This is working on Visual Studio Code (updated version up to the publishing date of this post).
<ItemGroup>
<None Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Upvotes: 2
Reputation: 859
Try to manipulate csproj:
<ItemGroup>
<None Update="FILE_PATH">
<CopyToOutputDirectory>ACTION_TYPE</CopyToOutputDirectory>
</None>
</ItemGroup>
Upvotes: 13