@@ -259,8 +259,6 @@ public bool Run()
259
259
{
260
260
Logger . Trace ( $ "Different assembly framework found. Switching to { this . environment . SwitchToFramework } ...") ;
261
261
}
262
- Logger . Trace ( "===============================" ) ;
263
- ProcessStartInfo startInfo = new ProcessStartInfo ( ) ;
264
262
string location = Assembly . GetEntryAssembly ( ) ? . Location ?? throw new InvalidOperationException ( "No location found" ) ;
265
263
Regex regex = new Regex ( @"(?<separator>[\\/])(?<framework>net[^\\/]+)[\\/]" ) ;
266
264
Match match = regex . Match ( location ) ;
@@ -275,10 +273,12 @@ public bool Run()
275
273
location = location . Replace ( separator + framework + separator , separator + switchedFramework + separator ) ;
276
274
if ( FileSystem . FileExists ( location ) )
277
275
{
278
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
276
+ ProcessStartInfo startInfo = new ProcessStartInfo ( ) ;
277
+ string locationExe = location . Replace ( ".dll" , ".exe" ) ;
278
+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) && FileSystem . FileExists ( locationExe ) )
279
279
{
280
280
// Always use the .exe on Windows to fix the dotnet.exe x86 problem
281
- startInfo . FileName = location . Replace ( ".dll" , ".exe" ) ; ;
281
+ startInfo . FileName = locationExe ;
282
282
}
283
283
else
284
284
{
@@ -297,6 +297,7 @@ public bool Run()
297
297
//startInfo.UseShellExecute = false;
298
298
//startInfo.RedirectStandardOutput = true;
299
299
//startInfo.RedirectStandardError = true;
300
+ Logger . Trace ( "===============================" ) ;
300
301
Process process = Process . Start ( startInfo ) ;
301
302
process . OutputDataReceived += ( sender , args ) => Logger . Trace ( ">> " + args . Data ) ;
302
303
process . ErrorDataReceived += ( sender , args ) => Logger . Error ( ">> " + args . Data ) ;
0 commit comments