How to exclude files from Visual Studio compile?

Viewed 97859

I'm in the process of refactoring a project. I've got an entire subfolder which is known to be broken. Is there any declarative way to exclude that folder from the compile temporarily while I test the refactoring thus far?

I realize I could delete the folder, but I'd like to do this through configuration if possible.

13 Answers

You could set the Build Action (in the Properties Window) to None for the files you want excluded. You could also right-click on the folder and choose Exclude from Project.

Right click all the files, and select Properties. Now set Action to None. Revert to Compile when you fixed the code :)

  1. Select the files that you don't want to have compiled on the Solution Explorer.

  2. Right click and choose Options...

  3. Set the "Build Action" on the files to "None".

That should do the trick for you!

You should just be able to right click on the folder name in your solution explorer, and click "exclude from project".

I'm quite sure that there should be a "Exclude from build" property on the folder, but I don't have my Visual Studio with me at the moment. At the very least there is such a property on files.

In Rider, right click file in Navigation Bar, click Properties, change Build action to None.

Related