Skip to content

dotnet sln add command inconsistent behaviour in .NET SDK 9.0.2xx #46891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidsekar opened this issue Feb 17, 2025 · 3 comments
Closed

dotnet sln add command inconsistent behaviour in .NET SDK 9.0.2xx #46891

davidsekar opened this issue Feb 17, 2025 · 3 comments
Labels
Area-CLI untriaged Request triage from a team member

Comments

@davidsekar
Copy link

davidsekar commented Feb 17, 2025

Describe the bug

There is an inconsistency while adding csproj to a solution file. This behaviour started after dotnet CLI moved to .NET SDK 9.0.2xx

To Reproduce

  • Create a console application named "My.Name.Dot"
    This creates a solution within "C:\Users\User.Name\source\repos\My.Name.Dot" and the project is placed within "C:\Users\User.Name\source\repos\My.Name.Dot\My.Name.Dot\My.Name.Dot.csproj"

  • Just for testing remove My.Name.Dot.csproj from the solution
    dotnet sln "My.Name.Dot.sln" remove "C:\Users\User.Name\source\repos\My.Name.Dot\My.Name.Dot\My.Name.Dot.csproj"
    and re-add with following command
    dotnet sln "My.Name.Dot.sln" add "C:\Users\User.Name\source\repos\My.Name.Dot\My.Name.Dot\My.Name.Dot.csproj"
    The project gets added to solution as expected

  • Now copy the csproj folder outside of this solution under "C:\Users\User.Name\source\repos\My.Name.Dot1\My.Name.Dot1.csproj"
    Now try to add this csproj to the solution as follows

dotnet sln "My.Name.Dot.sln" add "C:\Users\User.Name\source\repos\My.Name.Dot1\My.Name.Dot1.csproj"

This strangely throws an exception

Exceptions (if any)

Names cannot:

  • contain any of the following characters: / ? : \ * " < > |
  • contain control characters
  • be system reserved names, including 'CON', 'AUX', 'PRN', 'COM1' or 'LPT2'
  • be '.' or '..' (Parameter 'name')

Further technical details

dotnet --info
.NET SDK:
Version: 9.0.200
Commit: 90e8b20
Workload version: 9.0.200-manifests.c4f6226a
MSBuild version: 17.13.8+cbc39bea8

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.200\

@ghost ghost added Area-CLI untriaged Request triage from a team member labels Feb 17, 2025
@baronfel
Copy link
Member

Thanks for reporting this. We believe this is part of #46456, which will be released in the March update to the .NET SDK.

@davidsekar
Copy link
Author

I have gone through your earlier PR which addresses the relative path.
#46456

This issue is for an absolute path. Can you please confirm if the absolute path outside of solution folder gets resolved properly?

@baronfel
Copy link
Member

cc @edvilme for question about the fix^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants