mononugetxbuildnuget-package-restore

Building .NET project with xbuild on Linux environment


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?


Solution

  • 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>