Reputation: 3167
I'm trying to setup Cake build for my Xamarin project. It is working perfectly on Windows but fails on OS X (El Captain). build.sh is here, build.cake is here.
Build fails with on NuGetRestore this message:
MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.4.2/lib/mono/4.5'.
MsBuild.exe does not exist at '/Library/Frameworks/Mono.framework/Versions/4.4.2/lib/mono/4.5/msbuild.exe'.
An error occured when executing task 'Restore-NuGet-Packages'.
Error: NuGet: Process returned an error (exit code 1).
./build.sh -v "Diagnostic" gives:
Executing: /Users/artur/sources/xamarin-range-slider/tools/NuGet.exe restore "/Users/artur/sources/xamarin-range-slider/Xamarin.RangeSlider.sln" -Verbosity detailed -NonInteractive
MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.4.2/lib/mono/4.5'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
MSBuild P2P timeout [ms]: 120000
System.AggregateException: One or more errors occurred. ---> NuGet.CommandLineException: MsBuild.exe does not exist at '/Library/Frameworks/Mono.framework/Versions/4.4.2/lib/mono/4.5/msbuild.exe'.
at NuGet.CommandLine.MsBuildUtility.GetProjectReferences (System.String msbuildDirectory, System.String[] projectPaths, Int32 timeOut) <0x34e8ed0 + 0x00677> in <filename unknown>:0
at NuGet.CommandLine.RestoreCommand.DetermineRestoreInputs () <0x3452690 + 0x002af> in <filename unknown>:0
at NuGet.CommandLine.RestoreCommand+<ExecuteCommandAsync>d__23.MoveNext () <0x3451688 + 0x0028b> in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (Boolean includeTaskCanceledExceptions) <0x1d1d960 + 0x00049> in <filename unknown>:0
at System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) <0x1d1f150 + 0x000c8> in <filename unknown>:0
at System.Threading.Tasks.Task.Wait () <0x1d1ef70 + 0x00033> in <filename unknown>:0
at NuGet.CommandLine.Command.Execute () <0x343a298 + 0x00213> in <filename unknown>:0
at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x718cc0 + 0x005e0> in <filename unknown>:0
---> (Inner Exception #0) NuGet.CommandLineException: MsBuild.exe does not exist at '/Library/Frameworks/Mono.framework/Versions/4.4.2/lib/mono/4.5/msbuild.exe'.
at NuGet.CommandLine.MsBuildUtility.GetProjectReferences (System.String msbuildDirectory, System.String[] projectPaths, Int32 timeOut) <0x34e8ed0 + 0x00677> in <filename unknown>:0
at NuGet.CommandLine.RestoreCommand.DetermineRestoreInputs () <0x3452690 + 0x002af> in <filename unknown>:0
at NuGet.CommandLine.RestoreCommand+<ExecuteCommandAsync>d__23.MoveNext () <0x3451688 + 0x0028b> in <filename unknown>:0 <---
An error occured when executing task 'Restore-NuGet-Packages'.
Error: Cake.Core.CakeException: NuGet: Process returned an error (exit code 1).
at Cake.Core.Tooling.Tool`1[TSettings].ProcessExitCode (Int32 exitCode) <0x3a8b208 + 0x000fb> in <filename unknown>:0
at Cake.Core.Tooling.Tool`1[TSettings].Run (Cake.Core.Tooling.TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments, Cake.Core.IO.ProcessSettings processSettings, System.Action`1 postAction) <0x3a34a88 + 0x00177> in <filename unknown>:0
at Cake.Core.Tooling.Tool`1[TSettings].Run (Cake.Core.Tooling.TSettings settings, Cake.Core.IO.ProcessArgumentBuilder arguments) <0x3a34a48 + 0x0002f> in <filename unknown>:0
at Cake.Common.Tools.NuGet.Restore.NuGetRestorer.Restore (Cake.Core.IO.FilePath targetFilePath, Cake.Common.Tools.NuGet.Restore.NuGetRestoreSettings settings) <0x3a34328 + 0x0004b> in <filename unknown>:0
at Cake.Common.Tools.NuGet.NuGetAliases.NuGetRestore (ICakeContext context, Cake.Core.IO.FilePath targetFilePath, Cake.Common.Tools.NuGet.Restore.NuGetRestoreSettings settings) <0x3a33f18 + 0x0012f> in <filename unknown>:0
at CakeBuildScriptImpl.NuGetRestore (Cake.Core.IO.FilePath targetFilePath, Cake.Common.Tools.NuGet.Restore.NuGetRestoreSettings settings) <0x3a33ed8 + 0x0002b> in <filename unknown>:0
at CakeBuildScriptImpl+<Execute>c__AnonStorey0.<>m__0 () <0x3a33e40 + 0x00087> in <filename unknown>:0
at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass4.<Does>b__3 (ICakeContext context) <0x3a33e20 + 0x00014> in <filename unknown>:0
at Cake.Core.ActionTask.Execute (ICakeContext context) <0x3a33d68 + 0x00059> in <filename unknown>:0
at Cake.Core.DefaultExecutionStrategy.Execute (Cake.Core.CakeTask task, ICakeContext context) <0x3a33b18 + 0x00162> in <filename unknown>:0
at Cake.Core.CakeEngine.ExecuteTask (ICakeContext context, IExecutionStrategy strategy, System.Diagnostics.Stopwatch stopWatch, Cake.Core.CakeTask task, Cake.Core.CakeReport report) <0x3a33538 + 0x00099> in <filename unknown>:0
Upvotes: 2
Views: 1503
Reputation: 5010
This is likely because an version on NuGet.exe in path that that unaware of mono.
By running build.sh -v "Diagnostic"
you'll get an detailed log of how the NuGet command line is called for the restore operation.
There's also an overload for NuGetRestore(FilePath, NuGetRestoreSettings) on the NuGetRestoreSettings you can set the Verbosity property to Detailed to get more verbose logging from the NuGet command line.
If it's not the nuget.exe in your project tools folder you could change the bootstrapper to add tools folder first in path. (you can also set the ToolsPath property on the NuGetRestoreSettings if you just want to test that theory.
If it's running the path to NuGet.exe, check which version of nuget you have by running nuget without arguments (mono ./tools/nuget.exe
).
For reference this seems to be an known issue with NuGet console, reference GitHub issue NuGet/Home#3085
Upvotes: 2