Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet packages restoration failed with error code 127 when building a Xamarin.iOS project

I'm trying to build a Xamarin.iOS project in Xamarin Studio. Nuget packages restoration is enabled but during any build I get the following error:

/.nuget/NuGet.targets: Error: Command 'mono --runtime=v4.0.30319 "/.nuget/NuGet.exe" install "/ProjectName/packages.config" -source "" -RequireConsent -solutionDir "/" exited with code: 127. (ProjectName)

Running the same command from the terminal gives no issues and works absolutely fine with the following output message:

Restoring NuGet packages... To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.

.nuget/NuGet.exe and .nuget/NuGet.targets are up to date. With the disabled nuget restore at the project .csproj file compilation works just fine.

Please advise.

like image 569
Alexey Strakh Avatar asked Oct 04 '15 01:10

Alexey Strakh


1 Answers

Exit code: 127 = "command not found"

Does running that following cmd really work from the base solution directory?

mono --runtime=v4.0.30319 "/.nuget/NuGet.exe" install "/ProjectName/packages.config" -source "" -RequireConsent -solutionDir "/"
  • Mono not being able to find the CIL exe would result in an exit code of 2, but I am assuming it is not finding mono correctly...

If you type which mono is it found in /usr/local/bin or /usr/bin ?

Try :

sudo ln /Library/Frameworks/Mono.framework/Commands/mono /usr/bin

And retry from Xamarin Studio.

Ref: https://forums.xamarin.com/discussion/43192/os-x-10-11-el-capitan-beta-and-xamarin-compiler-error-127

like image 69
SushiHangover Avatar answered Oct 16 '22 07:10

SushiHangover