Export (0) Print
Expand All

Add New Item Command

Adds a new solution item, such as an .htm, .css, .txt, or frameset to the current solution and opens it.

File.AddNewSolutionItem [filename] [/t:templatename] [/e:editorname]


Optional. The path and file name of the item to add to the solution.


Optional. Specifies the type of file to be created. If no template name is given, a text file is created by default.

The /t:templatename argument syntax mirrors the information found in the Add New Solution Item dialog box. You must enter the complete category followed by the file type, separating the category name from the file type by a backslash (\) and enclosing the entire string in quotation marks.

For example, to create a new text file, you would enter the following for the /t:templatename argument.

/t:"General\Style Sheet"
Optional. The name of the editor in which the file will be opened. If the argument is specified but no editor name is supplied, the Open With dialog box appears.

The /e:editorname argument syntax uses the editor names as they appear in the Open With Dialog Box, enclosed in quotation marks.

For example, to open a style sheet in the source code editor, you would enter the following for the /e:editorname argument.

/e:"Source Code (text) Editor"


This example adds a new solution item, MyHTMLpg, to the current solution.

>File.AddNewSolutionItem MyHTMLpg /t:"General\HTML Page"

See Also

Visual Studio Commands with Arguments | Command Window | Find/Command Box | Pre-defined Visual Studio Command Aliases

© 2014 Microsoft