Share via


Working with Solution Items and Miscellaneous Items

Most projects in Visual Studio .NET are associated with a particular programming language or tool. There are two project types, however, that 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. The Solution Items project can contain any kind of file, and its contents are saved along with the solution when you save it. It might contain development notes, diagrams, implementation details, or other miscellaneous files you want to include with the solution that do not fit into any specific project.

You can reference Solution Items using Solution.Item(EnvDTE.Constants.vsProjectKindSolutionItems). If there are no solution items, then this statement fails. The UniqueName property returns "<SolutionFiles>" for this type of project.

The Miscellaneous Items Folder

Miscellaneous files are files that are not associated with a solution or its projects, but 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 .NET 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

  1. Select the Documents node under the Environment node in the Options dialog box.
  2. 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 not persisted.

The UniqueName property returns "<MiscFiles>" for this type of project. You can reference the Miscellaneous Files folder using Solution.Item(EnvDTE.Constants.vsProjectKindMisc).

Project properties and methods act on files in the Miscellaneous Files folder the same as regular project files, with the following exceptions:

Member Name Difference
FileName Property Returns the empty string since this project has no project file.
UniqueName Property Returns the string "<MiscFiles>".
SaveAs Method (General Extensibility) This method fails (E_NOIMPL) because there is no file to write.

See Also

Introduction to Solutions, Projects, and Items | Adding and Handling Commands | Creating and Controlling Environment Windows | Creating Add-Ins and Wizards | Creating an Add-In | Creating a Wizard | Automation and Extensibility Reference | Automation Object Model Chart