MS Visual Studio: How to exclude certain Project Folders from publishing?

meetpd picture meetpd · May 24, 2011 · Viewed 51.5k times · Source

I have certain folders which I want to keep in the project but not to include it in publishing.

Is that possible?

Answer

jbokkers picture jbokkers · May 24, 2011

Michael is totally right, through editing the .csproj file you can manually exclude files/folder from being published.

One easier way if you don't want to mess with the .csproj file is to highlight the file(s) inside the VS solution explorer. Under the properties panel, change build to action from 'content' to 'none'.

This way you don't have to unload the project from the solution, load the .csproj and add a line for each new file you add that doesn't need to be published but instead achieve the same with 3 mouse-clicks.

(assuming you've set the 'Only publish files needed to run this application' under the publishing tab)