Skip to content

Show folder guidance for duplicate project names - #744

Merged
Meera Ruxmohan (mruxmohan4) merged 3 commits into
microsoft:mainfrom
mruxmohan4:dev/mruxmohan/add-folder-guidance
Oct 23, 2026
Merged

Meera Ruxmohan (mruxmohan4) merged 3 commits into
microsoft:mainfrom
mruxmohan4:dev/mruxmohan/add-folder-guidance

Conversation

@mruxmohan4

Copy link
Copy Markdown
Contributor

Report conflicting project paths and recommend adding --folders true until the vs-solutionpersistence serializer can handle duplicates when validating the second project name. Also demonstrate the failure with a warning and nonzero exit code instead of an unhandled exception, preserving a failed build summary without logging an error.

Related issue: microsoft/vs-solutionpersistence#159

Before changes:

 SlnGen : error : Unhandled exception: Microsoft.VisualStudio.SolutionPersistence.Model.SolutionArgumentException: Project name 'common' already exists in the 'Root' solution folder.
SlnGen : error :    at Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.ValidateProjectName(SolutionProjectModel project)
SlnGen : error :    at Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.set_FilePath(String value)
SlnGen : error :    at Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.AddProject(String filePath, String projectTypeName, Guid projectTypeId, SolutionFolderModel folder)
SlnGen : error :    at Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.AddProject(String filePath, String projectTypeName, SolutionFolderModel folder)
SlnGen : error :    at Microsoft.VisualStudio.SlnGen.SlnFile.Save(ISolutionSerializer serializer, String rootPath, Boolean useFolders, ISlnGenLogger logger, Boolean collapseFolders, Boolean alwaysBuild)
SlnGen : error :    at Microsoft.VisualStudio.SlnGen.SlnFile.GenerateSolutionFile(ProgramArguments arguments, IEnumerable`1 projects, ISlnGenLogger logger)
SlnGen : error :    at Microsoft.VisualStudio.SlnGen.Program.Execute(ProgramArguments arguments, IConsole console)

    0 Warning(s)
    1 Error(s)

After changes:

Build started 10/23/2026 2:06:13 PM.
Generating solution for project "C:\Users\mruxmohan\.copilot\session-state\ab9f05ba-30d5-4c2c-9339-5a07ec5078f9\files\duplicate-repro\Repo.csproj"
Loading project references...
Loaded 3 project(s) in 1,242ms
Generating Visual Studio solution "C:\Users\mruxmohan\.copilot\session-state\ab9f05ba-30d5-4c2c-9339-5a07ec5078f9\files\duplicate-repro\guidance-flat.sln" ...
SlnGen : warning : The solution serializer requires project names to be unique within each solution folder (case-insensitive), even when the projects are in different directories on disk. Use --folders true (or SlnGenFolders=true) to create directory-based solution folders, or assign distinct SlnGenSolutionFolder values to the conflicting projects (src\Contracts\ServiceDescription\Common\Common.csproj; src\Services\DatacenterManager\DCM\common\common.csproj).

Failed

  SlnGen : warning : The solution serializer requires project names to be unique within each solution folder (case-insensitive), even when the projects are in different directories on disk. Use --folders true (or SlnGenFolders=true) to create directory-based solution folders, or assign distinct SlnGenSolutionFolder values to the conflicting projects (src\Contracts\ServiceDescription\Common\Common.csproj; src\Services\DatacenterManager\DCM\common\common.csproj).

    1 Warning(s)
    0 Error(s)

Report conflicting project paths and recommend --folders true. Handle duplicate-name failures with a warning and nonzero exit code instead of an unhandled exception, preserving a failed build summary without logging an error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab9f05ba-30d5-4c2c-9339-5a07ec5078f9
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab9f05ba-30d5-4c2c-9339-5a07ec5078f9
Use the MSBuild toolset selected by the test harness in the CLI subprocess PATH. Check specifically for duplicate-name guidance instead of rejecting unrelated warnings in successful solution generation tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab9f05ba-30d5-4c2c-9339-5a07ec5078f9
@mruxmohan4
Meera Ruxmohan (mruxmohan4) merged commit 7ca5640 into microsoft:main Oct 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants