3

In some older versions you could easily right click on the folders and exclude from build.

This function seems to be gone in VS 2017 Community. How do I achieve the same?

Update: it seems the function is not completely gone, it's possible to exclude files from the project when the Solution Explorer is not in folder view. This is not a solution anyway, since I need to exclude a whole folder that's got plenty of files, excluding them one by one is not at all a practical solution. It's something I can do in an emergency scenario, but not a reliable way of doing it.

Eärendil Baggins
  • 552
  • 1
  • 8
  • 23

3 Answers3

2

Press right-click on the file you want to exclude, and click on properties. In General->Excluded from build, select Yes.

machine_1
  • 4,266
  • 2
  • 21
  • 42
  • There is no "properties" option if I right click the file. – Eärendil Baggins Sep 26 '17 at 19:16
  • @EärendilBaggins Where are you clicking? You should click on the file in the Solution Explorer. – machine_1 Sep 26 '17 at 19:18
  • Was actually looking for a way to exclude a file from cleanup/rebuild. While this answer couldn't help in my case (intentionally), I still learned a new feature of VS that could come in handy in other cases. I found it as described by machine_1. Hence, +1 from me. – foobar Dec 02 '19 at 11:18
1

This answer may not be what you are looking for, but since "Publish Web App" is under the build tab, it fits and may help someone else.

In your "App_Data" folder there should be a "PublishProfiles" folder with a [projectname].pubxml file in it.

Add:

<ExcludeFoldersFromDeployment>
  foldername;otherfoldername
</ExcludeFoldersFromDeployment>

This will exclude listed folders from being published.

Expanding on that, for files:

<ExcludeFilesFromDeployment>
   gulpfile.js;PrecompiledApp.config
</ExcludeFilesFromDeployment>
drichardson
  • 141
  • 1
  • 3
0

As you mentioned this option is gone from more recent versions of VS. This is why I wrote this extension working in VS2013 and later:

https://marketplace.visualstudio.com/items?itemName=AdamWulkiewicz.ExcludeFromBuild

Adam Wulkiewicz
  • 2,068
  • 18
  • 24