Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

In Visual Studio, how can I set the Build Action for an entire folder?

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".

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...