Creating Solutions and Projects

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Projects are the logical containers for everything that's needed to build your application. When you create a project by choosing File | New | Project from the main menu, Visual Studio creates a solution to contain it. You can then add more new or existing projects to the solution if necessary. You can create projects from existing code files and you can create temporary projects (.NET only) that will be deleted when you are done with them.

Note

The descriptions in this topic are based on the Visual Studio Community 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.

Create a project from an installed project template

File | New | Project from the main menu to bring up the New Project dialog. In the left pane under Intalled | Templates chose the programming language and platform or technology, then choose from the available templates in the middle pane.

In the New Project dialog, the Solution drop-down gives you the option to create the new project in a new or existing solution, or in a new instance of Visual Studio.

Create a project from existing code files

If you have a collection of loose source files, you can easily create a project that contains them. Choose File | New |Project From Existing Code to start the Create Project from Existing Code Files Wizard and follow the prompts.

Tip

This option works best for relatively simple collections of files.

Create a temporary project (C# and Visual Basic)

By working with temporary projects, you can create and experiment with a .NET project without specifying a disk location. When you create a project, you just select a project type and template and specify a name in the New Project dialog box. At any time while you are working with the temporary project, you can save it, or you can discard it.

Create a .NET project that targets a specific version of the .NET Framework

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.

Downloading Sample Solutions

You can use Visual Studio to download and install sample solutions 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.

Adding single files at the solution level

Sometimes you might have a file that multiple projects refer to, or that contains text or miscellaneous data that logically belongs at the solution level rather than under a specific project. To add a single item to a solution:

  1. Right-click on the solution node in Solution Explorer and choose Add | New Item or Add | Existing Item.

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

Solutions and Projects NIB How to: Create Multi-Project Solutions