使用 Visual Studio Code 在构建时复制内容文件 [英] Copying Content files on build with Visual Studio Code
本文介绍了使用 Visual Studio Code 在构建时复制内容文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理一个包含内容文件的 C# 项目.在 MonoDevelop 中,我可以将类型设置为 Content
,将 Build Action
设置为 Copy if Newer
.我可以在 Visual Studio 中做类似的事情.
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.
如何使用 Visual Studio Code 执行此操作?我没有打开解决方案文件(我打开的是一个目录),我在 tasks.json
或 VSCode 中没有看到任何可用于配置的内容.
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.
推荐答案
尝试操作 csproj:
Try to manipulate csproj:
<ItemGroup>
<None Update="FILE_PATH">
<CopyToOutputDirectory>ACTION_TYPE</CopyToOutputDirectory>
</None>
</ItemGroup>
- FILE_PATH 是项目中的相对路径,例如.nlog.config".
- ACTION_TYPE - 有两种可能的选择:PreserveNewest(如果从不复制)和始终
- FILE_PATH is relative path inside your project, ex. "nlog.config".
- ACTION_TYPE - there are two possible choices: PreserveNewest (copy if never) and Always
这篇关于使用 Visual Studio Code 在构建时复制内容文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文