Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Microsoft.VisualStudio.SolutionPersistence/Errors.resx
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@
<value>Project path '{0}' already exists in the solution.</value>
<comment>Error message. {0} is the file path that already exists.</comment>
</data>
<data name="DuplicateProjectName_Arg1" xml:space="preserve">
<value>Project name '{0}' already exists in the solution folder.</value>
<data name="DuplicateProjectName_Arg2" xml:space="preserve">
<value>Project name '{0}' already exists in the '{1}' solution folder.</value>
<comment>Error message. {0} is the name of the folder.</comment>
</data>
<data name="InvalidFolderPath_Args1" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ internal void ValidateProjectName(SolutionProjectModel project)
}

string displayName = project.ActualDisplayName;
string folderPath = project.Parent?.Path ?? "Root";

foreach (SolutionProjectModel existingProject in this.SolutionProjects)
{
if (!ReferenceEquals(existingProject.Parent, project.Parent) || ReferenceEquals(existingProject, project))
Expand All @@ -597,7 +599,7 @@ internal void ValidateProjectName(SolutionProjectModel project)

if (existingProject.ActualDisplayName.Equals(displayName, StringComparison.OrdinalIgnoreCase))
{
throw new SolutionArgumentException(string.Format(Errors.DuplicateProjectName_Arg1, displayName), SolutionErrorType.DuplicateProjectName);
throw new SolutionArgumentException(string.Format(Errors.DuplicateProjectName_Arg2, displayName, folderPath), SolutionErrorType.DuplicateProjectName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void MoveProjectToFolder()

// Try moving project to folder with existing project
ArgumentException ex = Assert.Throws<SolutionArgumentException>(() => wanderingProject.MoveToFolder(folderA));
Assert.Equal(string.Format(Errors.DuplicateProjectName_Arg1, wanderingProject.ActualDisplayName), ex.Message);
Assert.Equal(string.Format(Errors.DuplicateProjectName_Arg2, wanderingProject.ActualDisplayName, folderA.Path), ex.Message);
Assert.Equal("/This/Is/A/Nested/Folder/", wanderingProject.Parent.ItemRef);

// Move project to root
Expand Down