@@ -16,7 +16,9 @@ public static CommandBuilder MsBuildCommand(this CommandBuilder cmdBuilder, IAut
16
16
// mono doesn't ship with `msbuild` on Arm-based Macs, but we can fall back to
17
17
// msbuild that ships with `dotnet` which can be invoked with `dotnet msbuild`
18
18
// 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
20
22
? cmdBuilder . RunCommand ( "dotnet" ) . Argument ( "msbuild" )
21
23
: cmdBuilder . RunCommand ( "msbuild" ) ;
22
24
}
@@ -74,15 +76,15 @@ BuildScript GetNugetRestoreScript() =>
74
76
Argument ( "-DisableParallelProcessing" ) .
75
77
Script ;
76
78
77
- var preferDotnet = ! builder . Actions . IsWindows ( ) && ! builder . Actions . IsMonoInstalled ( ) ;
79
+ var preferDotnet = builder . Actions . IsRunningOnAppleSilicon ( ) || ! builder . Actions . IsWindows ( ) && ! builder . Actions . IsMonoInstalled ( ) ;
78
80
79
81
var nugetRestore = GetNugetRestoreScript ( ) ;
80
82
var msbuildRestoreCommand = new CommandBuilder ( builder . Actions ) .
81
83
MsBuildCommand ( builder , preferDotnet ) .
82
84
Argument ( "/t:restore" ) .
83
85
QuoteArgument ( projectOrSolution . FullPath ) ;
84
86
85
- if ( builder . Actions . IsRunningOnAppleSilicon ( ) || preferDotnet )
87
+ if ( preferDotnet )
86
88
{
87
89
// On Apple Silicon, only try package restore with `dotnet msbuild /t:restore`
88
90
ret &= BuildScript . Try ( msbuildRestoreCommand . Script ) ;
0 commit comments