Como: Remover, Deletar e excluir itens
The procedure for taking items out of solutions, projects, and folders in Solution Explorer is straightforward. However, the project type determines whether you are deleting the file, keeping the file but removing it as an item in the project, or temporarily excluding it from the project or solution. For more general information about how projects manage files, see Gerenciamento de itens em projetos.
Removing, deleting, and excluding each describe a different degree of disassociation from the project or solution.
Se você gostaria de |
Then use |
---|---|
Disassociate an item from a solution, project, or folder but not remove its physical file |
Remove |
Permanently erase files from physical storage as well as the file item in solution, project, or folder |
Delete |
Temporarily disassociate an item from a project |
Exclude |
Temporarily disassociate a project from a solution |
Unload |
Selecting the project or item in Solution Explorer changes the menus and commands available in the development environment. The action performed by certain commands can vary depending on the project template you used to create the project. For more information on the specific project template you have selected, see New Project Dialog Box.
Removing
For projects that manage items as links, such as Visual C++, you can remove an item from your project. The item is removed from Solution Explorer and the item's file is disassociated from the project, but not permanently removed from storage. Projects that manage the items as files, such as Web projects, do not support the Remove command.
To remove an item or project
In Solution Explorer, select the item you want to remove.
On the Edit menu, select Remove.
Deleting
For projects that manage items either as files, such as Web projects, or using a combination of files and links, such as Visual Basic and Visual C#, you can delete an item from your project. The item is removed from Solution Explorer and the item's file is permanently removed from storage. Projects that manage the items as links do not support the Delete command.
To permanently delete an item
In Solution Explorer, select the item you want to delete.
On the Edit menu, select Delete.
Excluding
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 Como: Descarregar e recarregar projetos.
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:
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: Excluir itens de um projeto de implantação for alternative steps.
Observação |
---|
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. |
Unloading
To temporarily unload a project from a solution
In Solution Explorer, select the project you want to unload.
On the Project menu, select Unload Project.
Observação Unload Project is unavailable when the solution is not shown in Solution Explorer. To enable this command, select Always show solution in the Geral, projetos e soluções, caixa de diálogo Options.
Consulte também
Tarefas
Como: Descarregar e recarregar projetos
How to: Excluir arquivos de um Project Output Group