Solution Explorer
Creating New Projects
Create new .NET projects from templates directly within VS Code.
Overview
Section titled “Overview”C# Dev Tools provides full integration with the .NET CLI template system, allowing you to create new projects without leaving VS Code.
Creating a Project
Section titled “Creating a Project”There are several ways to create a new project:
From Solution Explorer
Section titled “From Solution Explorer”- Right-click on a solution or solution folder
- Select Add > New Project
- The project creation wizard will open
From Command Palette
Section titled “From Command Palette”- Press
Ctrl+Shift+P - Type “C# Solution Explorer: Create New Project”
- Select the command
The Project Creation Wizard
Section titled “The Project Creation Wizard”The wizard guides you through the project creation process:
Step 1: Select Template
Section titled “Step 1: Select Template”Browse and search through available project templates:
- Console Application - Command-line applications
- Class Library - Reusable code libraries
- ASP.NET Core Web App - Web applications with Razor Pages
- ASP.NET Core Web API - RESTful API services
- Blazor Server App - Server-side Blazor applications
- Blazor WebAssembly App - Client-side Blazor applications
- WPF Application - Windows desktop applications
- Windows Forms Application - Windows desktop applications
- xUnit Test Project - xUnit test projects
- NUnit Test Project - NUnit test projects
- MSTest Test Project - MSTest test projects
- And many more…
Use the search box to quickly find templates by name or technology.
Step 2: Configure Project
Section titled “Step 2: Configure Project”Provide the project configuration:
- Project Name: The name of your new project
- Location: Where to create the project (defaults to solution directory)
- Solution Folder: Optionally place the project in a solution folder
- Target Framework: Choose the .NET version (e.g., .NET 8.0, .NET 6.0)
Step 3: Template-Specific Options
Section titled “Step 3: Template-Specific Options”Some templates provide additional options:
Web Projects:
- Authentication type (None, Individual, Windows)
- HTTPS configuration
- Docker support
Class Libraries:
- Target framework
- Package options
Test Projects:
- Enable code coverage
- Additional test frameworks
Step 4: Create
Section titled “Step 4: Create”Click Create Project to generate the project:
- The .NET CLI will execute the template
- The project will be created in the specified location
- The project will be added to the solution
- The Solution Explorer will refresh to show the new project
After Project Creation
Section titled “After Project Creation”Once the project is created:
- The project appears in the Solution Explorer
- The solution file is updated with the new project reference
- You can immediately start editing files in the project
- Required NuGet packages (if any) are automatically restored
Custom Templates
Section titled “Custom Templates”The extension supports any .NET templates installed on your system:
Installing Custom Templates
Section titled “Installing Custom Templates”dotnet new install <template-package-name>For example:
dotnet new install Microsoft.AspNetCore.SpaTemplatesCustom templates will appear in the template selection list.
Listing Installed Templates
Section titled “Listing Installed Templates”To see all available templates:
dotnet new listTroubleshooting
Section titled “Troubleshooting”Template Not Found
Section titled “Template Not Found”If a template doesn’t appear:
- Ensure the .NET SDK is installed and in your PATH
- Run
dotnet new listin a terminal to verify the template is installed - Restart VS Code after installing new templates
Project Creation Failed
Section titled “Project Creation Failed”If project creation fails:
- Check the Output panel for error messages
- Verify you have write permissions in the target directory
- Ensure the project name is valid (no special characters)
- Check that the .NET SDK version supports the selected template
Project Not Added to Solution
Section titled “Project Not Added to Solution”If the project was created but not added to the solution:
- Right-click the solution in Solution Explorer
- Select Add > Existing Project
- Navigate to and select the .csproj file