我有一个非常简单的项目,用Visual 2013创建,使用Nancy应用程序模板。
在我的开发机器中,它正在由Visual 2013成功构建。
但是,当我尝试用xbuild在Linux环境上构建相同的源代码时,它就失败了。
这是输出:
root@jannes:/home/hitly/hitly/src/Hitly.Service# xbuild
XBuild Engine Version 12.0
Mono, Version 3.2.8.0
Copyright (C) 2005-2013 Various Mono authors
Build started 3/31/2014 2:11:49 PM.
__________________________________________________
Project "/home/hitly/hitly/src/Hitly.Service/Hitly.Service.csproj" (default target(s)):
Target RestorePackages:
Executing: mono --runtime=v4.0.30319 ../.nuget/NuGet.exe install "" -source "" -RequireConsent -solutionDir "../"
The specified path is not of a legal form (empty). /home/hitly/hitly/src/.nuget/NuGet.targets: error : Command 'mono --runtime=v4.0.30319 ../.nuget/NuGet.exe install "" -source "" -RequireConsent -solutionDir "../"' exited with code: 1.
Task "Exec" execution -- FAILED
Done building target "RestorePackages" in project "/home/hitly/hitly/src/Hitly.Service/Hitly.Service.csproj".-- FAILED
Done building project
"/home/hitly/hitly/src/Hitly.Service/Hitly.Service.csproj".-- FAILED
Build FAILED. Errors:
/home/hitly/hitly/src/Hitly.Service/Hitly.Service.csproj (default targets) -> /home/hitly/hitly/src/.nuget/NuGet.targets
(RestorePackages target) ->
/home/hitly/hitly/src/.nuget/NuGet.targets: error : Command 'mono --runtime=v4.0.30319 ../.nuget/NuGet.exe install "" -source "" -RequireConsent -solutionDir "../"' exited with code: 1.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.7254640我无法理解错误的原因。
如何在Linux上构建这些源代码?
发布于 2014-03-31 20:17:52
修好了!
我只是将PackagesConfig元素添加到.nuget/NuGet.targets中
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
++++<PackagesConfig>packages.config</PackagesConfig>
</PropertyGroup>发布于 2014-04-01 07:07:07
NuGet.targets是NuGet包恢复的关键文件,但NuGet人员并不很好地管理它的版本。
您遇到的问题只是表明您使用的版本并不是Mono友好的。您的编辑可能有效,但我建议您密切关注NuGet Git存储库,以获取最新的信息,如http://nuget.codeplex.com/SourceControl/latest#src/Build/NuGet.targets。
希望NuGet的人能够在Mono上做更多的测试,因为这样可以防止类似的问题长期发生。
(请忘记这个答案。NuGet最新控制台可以在最新的Mono上运行,并且恢复机制也会被更改,以摆脱这个目标文件。)
https://stackoverflow.com/questions/22769126
复制相似问题