@@ -16,7 +16,9 @@ public static CommandBuilder MsBuildCommand(this CommandBuilder cmdBuilder, IAut
1616 // mono doesn't ship with `msbuild` on Arm-based Macs, but we can fall back to
1717 // msbuild that ships with `dotnet` which can be invoked with `dotnet msbuild`
1818 // perhaps we should do this on all platforms?
19- return builder . Actions . IsRunningOnAppleSilicon ( ) || preferDotnet
19+ // Similarly, there's no point in trying to rely on mono if it's not installed.
20+ // In which case we can still fall back to `dotnet msbuild`.
21+ return preferDotnet
2022 ? cmdBuilder . RunCommand ( "dotnet" ) . Argument ( "msbuild" )
2123 : cmdBuilder . RunCommand ( "msbuild" ) ;
2224 }
@@ -74,15 +76,15 @@ BuildScript GetNugetRestoreScript() =>
7476 Argument ( "-DisableParallelProcessing" ) .
7577 Script ;
7678
77- var preferDotnet = ! builder . Actions . IsWindows ( ) && ! builder . Actions . IsMonoInstalled ( ) ;
79+ var preferDotnet = builder . Actions . IsRunningOnAppleSilicon ( ) || ! builder . Actions . IsWindows ( ) && ! builder . Actions . IsMonoInstalled ( ) ;
7880
7981 var nugetRestore = GetNugetRestoreScript ( ) ;
8082 var msbuildRestoreCommand = new CommandBuilder ( builder . Actions ) .
8183 MsBuildCommand ( builder , preferDotnet ) .
8284 Argument ( "/t:restore" ) .
8385 QuoteArgument ( projectOrSolution . FullPath ) ;
8486
85- if ( builder . Actions . IsRunningOnAppleSilicon ( ) || preferDotnet )
87+ if ( preferDotnet )
8688 {
8789 // On Apple Silicon, only try package restore with `dotnet msbuild /t:restore`
8890 ret &= BuildScript . Try ( msbuildRestoreCommand . Script ) ;
0 commit comments