在Visual Studio中,如何为整个文件夹设置“生成操作"? [英] In Visual Studio, how can I set the Build Action for an entire folder?

查看:140
本文介绍了在Visual Studio中,如何为整个文件夹设置“生成操作"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio中有一个项目.我需要与代码一起部署一些第三方文件.通常,我会将这些文件放在资源"目录中,并将每个文件的构建操作"设置为内容",将复制到输出目录"设置为如果更新则复制".

I have a project in Visual Studio. I need to deploy some 3rd party files along with my code. Typically I would put this files in a "Resources" directory and set the Build Action on each file to "Content" and the Copy To Output Directory to "Copy if newer".

无论如何,我可以在文件夹级别设置这些指令.我正在使用的当前项目有数十个这样的文件和几个子文件夹.我希望能够将整个目录设置为内容"和如果更新则复制".

Is there anyway I can set these directives at the folder level. The current project I am working with has dozens of such files and a couple of sub folders. I'd like to be able to make the entire directory as "Content" and "Copy if newer".

推荐答案

创建项目.添加一个文件作为内容.卸载项目并手动编辑* proj文件.

Create the project. Add one file as Content. Unload the project and edit the *proj file manually.

 <ItemGroup>
    <Content Include="myfolder**\*.dll**">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

然后在content-ItemGroup中,我将使用一些MsBuild通配符表达式,*.dll或其他内容替换该singe文件.

And then in the content-ItemGroup I would replace that singe file with some MsBuild wildcard expression, *.dll, or whatever.

这篇关于在Visual Studio中,如何为整个文件夹设置“生成操作"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆