Share via


Creating Solutions and Projects

When you create a project, Visual Studio creates a solution to contain it. If you plan to create a multi-project solution, see How to: Create Multi-Project Solutions. If you want to create a project from existing code files, see How to: Create a Project from Existing Code Files.

Note

If your anti-virus software displays a message that offers to block a script that the project template or wizard is running, choose not to block the script; otherwise, Visual Studio shuts down. You can prevent this message from being displayed when this script is run by clearing the anti-virus software setting for blocking script. However, changing this setting disables all script blocking, not just for Visual Studio.

Note

The descriptions in this topic are based on the Visual Studio Professional edition. The dialog boxes and menu commands you see might differ from those described here, depending on your settings or Visual Studio edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Customizing Development Settings in Visual Studio.

Projects and Templates

Visual Studio uses project templates to generate new projects based on user input. Each template represents a different project type. Individual files that users add to projects are generated from item templates.

You can locate installed project templates in the New Project dialog box by navigating the expanding list in the left pane under Installed. You can also navigate under Recent for project types that you have used recently or under Online for templates that you can download and install.

You can also use the search box in the upper right corner of the dialog to search for project templates. The search will populate the middle pane with results from the recent, installed, or online list, depending on which category is selected. For more information, see Creating Projects from Templates.

Creating Projects

When a project is created, a solution is automatically generated unless the project is already part of a solution.

To create a project and a solution to contain it

  1. On the File menu, click New and then click Project.

    Tip

    Depending on the development settings you have chosen, you may see File, then New Project. For more information on settings, see Customizing Development Settings in Visual Studio.

    This opens the New Project dialog box.

  2. In the left pane, select Installed, and select a category of project types from the expanded list.

    If you have recently created a project of the same type, select Recent instead for faster navigation.

  3. Select one of the project Templates from the middle pane.

    A description of the selected template appears in the right pane.

  4. In the Name box, type a name for the new project.

    Note

    For some project types, the Name box is unavailable because specifying the location sets the project name. For example, a Web application or an XML Web service is located on a Web server and derives its name from the virtual directory specified on that server.

  5. In the Location box, select a save location.

    Note

    The Location box may be unavailable if you are creating a temporary project. For more information, see Temporary Projects.

  6. If available, in the Solution list, specify whether to create a solution or add the project to the solution that is open in Solution Explorer.

  7. In the Solution name box, type a name for the solution.

    Visual Studio will use this name for the namespace of the finished project if applicable. By default, the solution name will match the project name.

  8. Make sure that the Create directory for solution check box is selected.

  9. Click OK.

You can create a project to target earlier versions of the .NET Framework by using the .NET Framework version drop-down menu at the top of the New Project dialog box. Set this value before selecting a project template, as only templates compatible with that .NET Framework version will appear in the list.

You must have .NET Framework 3.5 installed on your system to access framework versions earlier than 4.0.

Creating Solutions from Online Samples

You can use Visual Studio to download and install samples of full, packaged applications from the MSDN Code Gallery.

You can download the samples individually, or you can download a Sample Pack, which contains related samples that share a technology or topic. You'll receive a notification when source code changes are published for any sample that you download.

For more information, see Visual Studio Samples.

Creating Empty Solutions

Although a project must reside in a solution, you can create a solution that has no projects.

To create an empty solution

  1. On the File menu, click New and then click New Project.

  2. In the left pane, select Installed, select Other Project Types, and then select Visual Studio Solutions from the expanded list.

  3. In the middle pane, select Blank Solution.

  4. Set the Name and Location values for your solution, then click OK.

After you create an empty solution, you can add new or existing projects or items to it by clicking Add New Item or Add Existing Item on the Project menu.

Deleting Solutions

You can delete a solution permanently, but not by using Visual Studio. Before you delete a solution, move any projects that you might want to use again in another solution. Then use File Explorer to delete the directory that contains the .sln and .suo solution files.

Note

The .suo file is a hidden file that is not displayed under default File Explorer settings.

To delete a solution

  1. In Solution Explorer, right-click the solution to delete, and select Open folder in File Explorer.

  2. In File Explorer, navigate up one level.

  3. Select the directory containing the solution and press Delete.

See Also

Tasks

How to: Create Multi-Project Solutions

Concepts

Solutions and Projects