Skip to content

dotnet new invalid solution project references if used in path with dashes #3666

@CryoMyst

Description

@CryoMyst

For certain dotnet new templates projects references can fail if the root directory has dashes in it.

Replication:

  1. Create a folder with dashes, example: "Test-Folder"
  2. cd into folder
  3. Run dotnet new with a template that creates a solution. Example: dotnet new maui-blazor
  4. Open solution and see projects are referenced with underscores but references with dashes.

Using dotnet new maui-blazor inside a Maui-Blazor-Dash folder the following directory structure is created

Maui-Blazor-Dash
    Maui-Blazor-Dash
        Maui-Blazor-Dash.csproj
    Maui-Blazor-Dash.WinUI
        Maui-Blazor-Dash.WinUI.csproj
    Maui-Blazor-Dash.sln

However Maui-Blazor-Dash.sln contains the following (Notice underscores instead of dashes like the path):

Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maui_Blazor_Dash", "Maui_Blazor_Dash\Maui_Blazor_Dash.csproj", "{C0457748-FBE1-4B5D-8AA4-4537749C6356}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maui_Blazor_Dash.WinUI", "Maui_Blazor_Dash.WinUI\Maui_Blazor_Dash.WinUI.csproj", "{842C3919-DBFE-4591-983C-9D21575F3CE4}"
EndProject

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions