File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/Cli/dotnet/commands/dotnet-sln/add Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ private async Task AddProjectsToSolutionAsync(string solutionFileFullPath, strin
82
82
var relativePath = Path . GetRelativePath ( Path . GetDirectoryName ( solutionFileFullPath ) , projectPath ) ;
83
83
try
84
84
{
85
- solution . AddProject ( relativePath , null , solutionFolder ) ;
85
+ AddProjectWithDefaultGuid ( solution , relativePath , solutionFolder ) ;
86
86
Reporter . Output . WriteLine ( CommonLocalizableStrings . ProjectAddedToTheSolution , relativePath ) ;
87
87
}
88
88
catch ( Exception ex )
@@ -107,5 +107,20 @@ private string GetSolutionFolderPathWithForwardSlashes()
107
107
// SolutionModel::AddFolder expects path to have leading, trailing and inner forward slashes
108
108
return PathUtility . EnsureTrailingForwardSlash ( PathUtility . GetPathWithForwardSlashes ( Path . Join ( "/" , _solutionFolderPath ) ) ) ;
109
109
}
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
+ }
110
125
}
111
126
}
You can’t perform that action at this time.
0 commit comments