我正在尝试为我的Xamarin项目设置Cake构建。它在Windows上完美运行但在OS X(El Captain)上失败。 build.sh is here,build.cake is here。
构建失败,在NuGetRestore上显示以下消息:
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
./ build.sh -v&#34; Diagnostic&#34;给出:
git flow init
答案 0 :(得分:2)
这可能是因为NuGet.exe上的一个版本在路径上没有发现单声道。
通过运行build.sh -v "Diagnostic"
,您将获得有关如何为恢复操作调用NuGet命令行的详细日志。
NuGetRestore(FilePath, NuGetRestoreSettings) NuGetRestoreSettings上也存在重载,您可以将Verbosity属性设置为Detailed,以便从NuGet命令行获取更详细的日志记录。
如果它不是项目工具文件夹中的nuget.exe,您可以更改引导程序以首先在路径中添加工具文件夹。 (如果您只是想测试该理论,也可以在NuGetRestoreSettings上设置ToolsPath属性。
如果它正在运行NuGet.exe的路径,请通过运行不带参数的nuget(mono ./tools/nuget.exe
)来检查您拥有的nuget版本。
作为参考,这似乎是NuGet控制台的一个已知问题,参考GitHub问题NuGet/Home#3085