@@ -150,8 +150,6 @@ internal static ColumnInformation GetSanitizedColumnInformation(ColumnInformatio
150
150
{
151
151
result . TextColumnNames . Add ( Sanitize ( value ) ) ;
152
152
}
153
-
154
-
155
153
return result ;
156
154
}
157
155
@@ -174,42 +172,52 @@ internal static string FormatCode(string trainProgramCSFileContent)
174
172
}
175
173
176
174
177
- internal static void AddProjectsToSolution ( string modelprojectDir ,
175
+ internal static int AddProjectsToSolution ( string modelprojectDir ,
178
176
string modelProjectName ,
179
177
string predictProjectDir ,
180
178
string predictProjectName ,
181
179
string trainProjectDir ,
182
180
string trainProjectName ,
183
181
string solutionName )
184
182
{
185
- var proc2 = new System . Diagnostics . Process ( ) ;
186
- proc2 . StartInfo . FileName = @"dotnet" ;
187
-
188
- proc2 . StartInfo . Arguments = $ "sln { solutionName } add { Path . Combine ( trainProjectDir , trainProjectName ) } { Path . Combine ( predictProjectDir , predictProjectName ) } { Path . Combine ( modelprojectDir , modelProjectName ) } ";
189
- proc2 . StartInfo . UseShellExecute = false ;
190
- proc2 . StartInfo . RedirectStandardOutput = true ;
191
- proc2 . Start ( ) ;
192
- string outPut2 = proc2 . StandardOutput . ReadToEnd ( ) ;
193
-
194
- proc2 . WaitForExit ( ) ;
195
- var exitCode2 = proc2 . ExitCode ;
196
- proc2 . Close ( ) ;
183
+ var proc = new System . Diagnostics . Process ( ) ;
184
+ try
185
+ {
186
+ proc . StartInfo . FileName = @"dotnet" ;
187
+ proc . StartInfo . Arguments = $ "sln \" { solutionName } \" add \" { Path . Combine ( trainProjectDir , trainProjectName ) } \" \" { Path . Combine ( predictProjectDir , predictProjectName ) } \" \" { Path . Combine ( modelprojectDir , modelProjectName ) } \" ";
188
+ proc . StartInfo . UseShellExecute = false ;
189
+ proc . StartInfo . RedirectStandardOutput = true ;
190
+ proc . Start ( ) ;
191
+ string outPut = proc . StandardOutput . ReadToEnd ( ) ;
192
+ proc . WaitForExit ( ) ;
193
+ var exitCode = proc . ExitCode ;
194
+ return exitCode ;
195
+ }
196
+ finally
197
+ {
198
+ proc . Close ( ) ;
199
+ }
197
200
}
198
201
199
- internal static void CreateSolutionFile ( string solutionFile , string outputPath )
202
+ internal static int CreateSolutionFile ( string solutionFile , string outputPath )
200
203
{
201
204
var proc = new System . Diagnostics . Process ( ) ;
202
- proc . StartInfo . FileName = @"dotnet" ;
203
-
204
- proc . StartInfo . Arguments = $ "new sln --name { solutionFile } --output { outputPath } --force";
205
- proc . StartInfo . UseShellExecute = false ;
206
- proc . StartInfo . RedirectStandardOutput = true ;
207
- proc . Start ( ) ;
208
- string outPut = proc . StandardOutput . ReadToEnd ( ) ;
209
-
210
- proc . WaitForExit ( ) ;
211
- var exitCode = proc . ExitCode ;
212
- proc . Close ( ) ;
205
+ try
206
+ {
207
+ proc . StartInfo . FileName = @"dotnet" ;
208
+ proc . StartInfo . Arguments = $ "new sln --name \" { solutionFile } \" --output \" { outputPath } \" --force";
209
+ proc . StartInfo . UseShellExecute = false ;
210
+ proc . StartInfo . RedirectStandardOutput = true ;
211
+ proc . Start ( ) ;
212
+ string outPut = proc . StandardOutput . ReadToEnd ( ) ;
213
+ proc . WaitForExit ( ) ;
214
+ var exitCode = proc . ExitCode ;
215
+ return exitCode ;
216
+ }
217
+ finally
218
+ {
219
+ proc . Close ( ) ;
220
+ }
213
221
}
214
222
}
215
223
}
0 commit comments