@@ -9,10 +9,13 @@ namespace GitVersion
9
9
10
10
class SpecifiedArgumentRunner
11
11
{
12
- const string MsBuild = @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" ;
12
+ private static readonly bool runningOnMono = Type . GetType ( "Mono.Runtime" ) != null ;
13
+ public static readonly string BuildTool = runningOnMono ? "xbuild" : @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" ;
13
14
14
15
public static void Run ( Arguments arguments , IFileSystem fileSystem )
15
16
{
17
+ Logger . WriteInfo ( string . Format ( "Running on {0}." , runningOnMono ? "Mono" : "Windows" ) ) ;
18
+
16
19
var noFetch = arguments . NoFetch ;
17
20
var authentication = arguments . Authentication ;
18
21
var targetPath = arguments . TargetPath ;
@@ -74,14 +77,14 @@ static bool RunMsBuildIfNeeded(Arguments args, string workingDirectory, VersionV
74
77
{
75
78
if ( string . IsNullOrEmpty ( args . Proj ) ) return false ;
76
79
77
- Logger . WriteInfo ( string . Format ( "Launching {0} \" {1}\" {2}" , MsBuild , args . Proj , args . ProjArgs ) ) ;
80
+ Logger . WriteInfo ( string . Format ( "Launching build tool {0} \" {1}\" {2}" , BuildTool , args . Proj , args . ProjArgs ) ) ;
78
81
var results = ProcessHelper . Run (
79
82
Logger . WriteInfo , Logger . WriteError ,
80
- null , MsBuild , string . Format ( "\" {0}\" {1}" , args . Proj , args . ProjArgs ) , workingDirectory ,
83
+ null , BuildTool , string . Format ( "\" {0}\" {1}" , args . Proj , args . ProjArgs ) , workingDirectory ,
81
84
GetEnvironmentalVariables ( variables ) ) ;
82
85
83
86
if ( results != 0 )
84
- throw new WarningException ( "MsBuild execution failed, non-zero return code") ;
87
+ throw new WarningException ( string . Format ( "{0} execution failed, non-zero return code", runningOnMono ? "XBuild" : "MSBuild" ) ) ;
85
88
86
89
return true ;
87
90
}
0 commit comments