microsoft / microsoft/vscode-dotnettools
[BUG] Unable to add existing projects with identical names in different solution folders
@Jxwoon is already working on this.
Since May 7, 2025.
- Dominant language
- No language data
- Stars
- 321
- Forks
- 54
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 2
Description
Describe the Issue
Unable to create new/add existing projects with identical names in different scenarios as mentioned below.
Note: Considering the project with identical name exists in different folder.
Scenario 1:
If I try to add an existing project that has the same name as another project in the Solution, it fails and shows an error message "The Solution already contains an item named 'project name'.
However, I can create a new project with the same name without any problem.
Scenario 2:
Also, When I just remove the project which has same name and try to re-add using "Add Existing Project" Option. That shows the same error mentioned above.
Scenario 3:
When I try this on main Solution folder where sln file exists, I get the same error for both add new/existing project option.
However, I can create or add existing project with same name on the main Solution folder using dotnet CLI.
Steps To Reproduce
Considering Solution folders are not real folders on disk by design. Please check the steps to reproduce the issue in different scenarios below.
Please check the folder structure as mentioned below.
Main Solution
|
|___Folder1
| |___Project1
| |___Project2
|
|___Folder2
| |___Project1
| |___Project2
| |___Project3
|
|___Project1
|___Solution.sln
Scenario 1
Steps to reproduce the issue.
- Create a Solution folder inside a main Solution.
- Click on Add Project on that Solution folder. Select Project template.
- While naming the Project, it automatically includes the Solution folder name which creates a physical folder on the disk.
- Repeat Step 1 to Step 3 and add another Solution folder and try to create a project with same name. It works.
- Repeat Step 1 to Step 3 and add another Solution folder.
- Click on Add Existing Project on that Solution folder and try adding existing project with same name. (manually create one in that solution folder using dotnet CLI)
- It will show an error "The Solution already contains an item named 'project name'.
Scenario 2
Steps to reproduce the issue.
- Create multiple folders and projects with identical names in each folder as per the folder structure.
- Right-Click on one of the projects with identical name and select remove to remove the project from the solution.
- Try to add the same project back using Add Existing Project option.
- It will show the same error as mentioned earlier.
Scenario 3
Steps to reproduce the issue.
- Create multiple folders and projects with identical names in each folder as per the folder structure.
- Try to create/add existing projects with identical names on the main Solution folder where sln file exists.
- It will show the same error as mentioned earlier.
- Now, Try to create new/add existing projects with identical names on the main Solution folder using dotnet CLI. It works again.
Expected Behavior
Both Add Project and Add Existing Project option should allow projects with identical names considering that we are trying to create new/add existing projects in different folder.
Environment Information
- OS: Windows 11
- VS Code Version: 1.82.2
- Extension: C# Dev Kit v0.4.10
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.