Pergunta

I have very simple project that created with Visual Studio 2013, using Nancy Asp.Net Web Application template.

In my development machine, it is building by Visual Studio 2013 successfully.

But when I try to build same sources on Linux Mono environment with xbuild, it is failing.

Here is the output:

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

I couldn't understand reason of the error.

How can I build these sources on Linux?

Foi útil?

Solução

Fixed!

I simply added PackagesConfig element to .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>

Outras dicas

NuGet.targets is a key file for NuGet package restore, but its versions are not well managed by NuGet guys.

The issue you met simply indicates that the version you use is not Mono friendly. Your edit might work, but I recommend you keep an eye on NuGet Git repository to grab the latest, such as http://nuget.codeplex.com/SourceControl/latest#src/Build/NuGet.targets.

Hope NuGet guys can do more testing on Mono as that can prevent similar issues in the long run.

(Please forget about this answer. NuGet latest console can run on latest Mono and the restore mechanism is also changed to get rid of this targets file.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top