|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Working with Solution Items and Miscellaneous Items
Most projects in Visual Studio are associated with a particular programming language or tool. Two project types, however, are not.
The Solution Items Project
The Solution Items project appears in Solution Explorer when you add an item to the solution, not to the integrated development environment (IDE) or a project. That is, when you right-click the solution and select New Item or Existing Item on the Add menu. Such items are associated with the solution itself and not with any project that happens to be in the solution.
The Solution Items project can contain any kind of file, and its contents are saved along with the solution. It might contain development notes, diagrams, implementation details, or other miscellaneous files you want to include with the solution but that do not fit into any specific project.
You can reference Solution Items by using Solution.Item(EnvDTE.Constants.vsSolutionItemsProjectUniqueName). If there are no solution items, then this statement fails. Theproperty returns "<SolutionFiles>" for this type of project.
The Miscellaneous Items Folder
Miscellaneous Items folder contains files that are not associated with a solution or its projects but that appear in Solution Explorer for your convenience. Miscellaneous Items is not really a project but rather a folder that is essentially a scratch pad service for Visual Studio that allows you to, for example, temporarily create a text document.
The Miscellaneous Items folder is always present in Solution Explorer, but it is hidden by default. You can choose to view it, however.
To view the Miscellaneous Items project
On the Tools menu, click Options.
Expand the Environment node in the left pane and click Documents.
Select the Show Miscellaneous files in Solution Explorer box.
If you display the Miscellaneous Files folder, you can also choose an option that specifies how many recently used miscellaneous files are restored to the Miscellaneous Files folder in Solution Explorer when you open the solution.
Normally, when the IDE is closed, the contents of the Miscellaneous Files folder are discarded unless you explicitly save the files. If you create a new file when no solution is open, a temporary one is created, but it is not persisted.
The UniqueName property returns "<MiscFiles>" for this type of project. You can reference the Miscellaneous Files folder by using Solution.Item(EnvDTE.Constants.vsMiscFilesProjectUniqueName).
Project properties and methods act on files in the Miscellaneous Files folder the same as regular project files, with the following exceptions:
Returns the empty string because this project has no project file.
Returns the string "<MiscFiles>".
This method fails (E_NOIMPL) because there is no file to write.