在Linux环境中使用xbuild构建.NET项目

Oğu*_*pçu 2 mono xbuild nuget nuget-package-restore

我使用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
Run Code Online (Sandbox Code Playgroud)

我无法理解错误的原因.

如何在Linux上构建这些源代码?

Oğu*_*pçu 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>
Run Code Online (Sandbox Code Playgroud)