views:

3472

answers:

7

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.

+1  A: 

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

leppie
The answers provided are good. However, the Build Action doesn't appear for code-behind files in a web site. I should have been more specific about my case. I'll make a new question for that scenario.
Larsenal
+1  A: 

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

Kibbee
A: 

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.

JesperE
A: 

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!

Mat Nadrofsky
+5  A: 

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.

Rob Windsor
Many correct answers, but one is formatted best, IMO.
Larsenal
I asked a related question for Web Site codebehind here: http://stackoverflow.com/questions/219417/how-to-exclude-web-site-code-behind-files-from-visual-studio-compile
Larsenal
A: 

In Visual Studio 2010 you need to right click the project in the Solution Explorer and choose Unload Project

Andrei
A: 

In VS 2010, right-click on the CPP module, choose Properties.

Then click on Configuration Properties -> General, Exclude from Build = Yes.

"Exclude from Project" is no good, it disappears from the other Configurations as well.