Using the Exclude command, you can temporarily remove an item from the project. After excluding the file, you can still see it in Solution Explorer by clicking Show All Files. For projects that manage items either as files, or using a combination of files and links, you can exclude an item from your project.
Not all projects allow you to exclude project items from builds. References in Visual C++, other reference-based projects and links to files in Visual Basic and Visual C# projects can be excluded from the project using slightly different methods.
Additionally, you can remove an entire project, and all of its contents from the solution using the Unload command. For more information, see How to: Unload and Reload Projects.
Physical project items in Web and other directory-based projects and physical project items in Visual Basic, Visual C#, and other mixed-model projects can be temporarily removed from a project using the Exclude From Project command.
To temporarily exclude an item that represents a file
In Solution Explorer, select the item you want to exclude.
On the Project menu, select Exclude From Project.
You can include the excluded file in your project by using the Include in Project command.
To include an item that represents a file
In Solution Explorer, select Show All Files. The button for that command looks like this:
.gif)
Select the item.
On the Project menu, select Include in Project.
Excluding Items from Deployment Projects
To exclude an item from a deployment project
In Solution Explorer, select the file you want to exclude.
On the Solution Explorer toolbar, select Properties.
In the Properties window, set the Exclude property to True.
See How to: Exclude Items from a Deployment Project for alternative steps.
Note: |
|---|
Adding a file to a project directory in Windows Explorer does not automatically add that file to the project; the file will appear in
Solution Explorer in the Show All Files view but it is not part of the project until you select Include in Project from the Project menu.
|