Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 601
brendan Avatar asked Jan 13 '10 19:01

brendan


People also ask

How do I change the build output directory in Visual Studio?

Right-click on the project node in Solution Explorer and select Properties. Expand the Build section, and select the Output subsection. Find the Base output path for C#, and type in the path to generate output to (absolute or relative to the root project directory), or choose Browse to browse to that folder instead.

How do you set a build action?

Set a build action Or, right-click on the file in Solution Explorer and choose Properties. In the Properties window, under the Advanced section, use the drop-down list next to Build Action to set a build action for the file.

How do I open a whole folder in Visual Studio?

In Visual Studio, click File > Open > Folder. Navigate to the folder, and click Select Folder. This opens the folder in Solution Explorer and displays its contents, files and any subfolders.

How do you set a build action to a resource?

using command promptClick in the solution explorer the file that will be modified. Then hit F4 or click with the right button in the file and then select the "Properties" option. In the Properties window, change Build Action to Embedded Resource.


1 Answers

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.

like image 185
Arve Avatar answered Sep 27 '22 22:09

Arve