我使用Nancy Asp.Net Web应用程序模板,使用Visual Studio 2013创建了非常简单的项目。
在我的开发机器中,它是由Visual Studio 2013成功构建的。
但是当我尝试使用xbuild在Linux Mono环境中构建相同的源时,它失败了。
这是输出:
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上构建这些源?
答案 0 :(得分:5)
固定!
我只是将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>
答案 1 :(得分:2)
NuGet.targets是NuGet包恢复的关键文件,但其版本不受NuGet人员的良好管理。
您遇到的问题只表示您使用的版本不是单声道友好的。您的编辑可能有效,但我建议您密切关注NuGet Git存储库以获取最新信息,例如http://nuget.codeplex.com/SourceControl/latest#src/Build/NuGet.targets。
希望NuGet的人可以在Mono上做更多的测试,因为从长远来看,这可以防止类似的问题。
(请忘记这个答案.NuGet最新的控制台可以在最新的Mono上运行,恢复机制也会更改为摆脱这个目标文件。)