Skip to content

dotnet new - Option to create solution implicitly when project is created #3782

Open

Description

@vatsan-madhavan

When a new project is created, can we consider an option to create a new solution as well ?

I can think of two workflows for new project creation:

(a) Adding a new project to an existing cohort of projects (which may already contain a solution)
(b) Instantiating a brand new cohort of project(s), which could use a solution file for working with IDE.

I'm interested in improving the experience of the second (b) workflow, which works like this today:

dotnet new $template
dotnet new sln
dotnet sln add $project
// Use sln

I'd like to propose a switch addition to dotnet new <TEMPLATE> - --create-solution | -sln - which will much like dotnet new sln.

The updated dotnet new would look like this:

dotnet new <TEMPLATE> [--dry-run] [--force] [-lang|--language {"C#"|"F#"|VB}] [-sln|--create-solution]
    [-n|--name <OUTPUT_NAME>] [-o|--output <OUTPUT_DIRECTORY>] [Template options]

dotnet new -h|--help

For example, dotnet new classlib -sln would generate classlib.csproj as well as classlib.sln, and classlib.csproj to classllib.sln.

Similar to dotnet new sln, if a solution file already exists in the location, an error would occur.

Activity

  1. added
    triaged
    on Aug 30, 2021
  2. added this to the Backlog milestone on Aug 30, 2021
  3. vlada-shubina commented on Dec 6, 2022

    @vlada-shubina
    Member

    Can be addressed by #3208.

  4. added
    feature
    Priority:2
    area: authoring
    on May 18, 2023
  5. YuliiaKovalova commented on Mar 3, 2026

    @YuliiaKovalova
    Member

    This workflow is available today through the DotnetTemplateMCP MCP server's template_compose tool, which chains multiple template operations in a single orchestrated call.

    The exact workflow from this issue (project + solution + sln add) becomes:

    template_compose(stepsJson=[
      {"templateName": "classlib", "name": "MyLib", "outputPath": "./src/MyLib"},
      {"templateName": "sln", "name": "MyLib", "outputPath": "."}
    ])
    

    This creates the project, creates the solution, and wires them together — equivalent to the proposed dotnet new classlib -sln.

    For more complex scenarios (API + test project + solution), the same tool scales:

    template_compose(stepsJson=[
      {"templateName": "webapi", "name": "MyApi", "outputPath": "./src/MyApi"},
      {"templateName": "xunit", "name": "MyApi.Tests", "outputPath": "./tests/MyApi.Tests"},
      {"templateName": "sln", "name": "MyApi", "outputPath": "."}
    ])
    

    See also the related comment on #3208: #3208 (comment)

    Source: DotnetTemplateMCP | NuGet

  6. added
    triage:transfer-to-sdk
    on May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:2area: authoringfeaturetriage:transfer-to-sdktriaged

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions