Skip to content

Commit 90f4248

Browse files
committed
Fix additional tests
1 parent c03cad7 commit 90f4248

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Cli/dotnet/commands/dotnet-sln/add/Program.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private async Task AddProjectsToSolutionAsync(string solutionFileFullPath, strin
8282
var relativePath = Path.GetRelativePath(Path.GetDirectoryName(solutionFileFullPath), projectPath);
8383
try
8484
{
85-
solution.AddProject(relativePath, null, solutionFolder);
85+
AddProjectWithDefaultGuid(solution, relativePath, solutionFolder);
8686
Reporter.Output.WriteLine(CommonLocalizableStrings.ProjectAddedToTheSolution, relativePath);
8787
}
8888
catch (Exception ex)
@@ -107,5 +107,20 @@ private string GetSolutionFolderPathWithForwardSlashes()
107107
// SolutionModel::AddFolder expects path to have leading, trailing and inner forward slashes
108108
return PathUtility.EnsureTrailingForwardSlash( PathUtility.GetPathWithForwardSlashes(Path.Join("/", _solutionFolderPath)) );
109109
}
110+
111+
private void AddProjectWithDefaultGuid(SolutionModel solution, string relativePath, SolutionFolderModel solutionFolder)
112+
{
113+
try
114+
{
115+
solution.AddProject(relativePath, null, solutionFolder);
116+
}
117+
catch (ArgumentException ex)
118+
{
119+
if (ex.Message == "ProjectType '' not found. (Parameter 'projectTypeName')")
120+
{
121+
solution.AddProject(relativePath, "130159A9-F047-44B3-88CF-0CF7F02ED50F", solutionFolder);
122+
}
123+
}
124+
}
110125
}
111126
}

0 commit comments

Comments
 (0)