How to call NuGet3 on a Mac from terminal for a Xamarin.Forms project?

I want to be able to build a Xamarin.Forms project on a Mac from terminal (with xbuild) and one of the steps is to make a package restore. Thereby I get the following error:

The 'Microsoft.NETCore.UniversalWindowsPlatform 5.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.12.0.0'.

The UWP platform shouldn't be build on the Mac, but nevertheless I think I will need NuGet3 for other NuGet packages. Under /private/etc/paths.d I found mono-commands file pointing to /Library/Frameworks/Mono.framework/Versions/Current/Commands. One of the commands is nuget, which is an alias pointing to /Library/Frameworks/Mono.framework/Versions/5.2.0/bin/nuget. This is the version 2.12.0.0 he uses in the terminal if you use the nuget command. In the bin folder I also saw nuget3, but I can't call it from the terminal. Here I get

command not found

So I don't think I need to update to NuGet3 and also no updates are shown currently. In addition, I don't know how I can call nuget3. Should I also create an alias for it? What if there is an update? Am I on the right track?

I have Xamarin Studio installed and the about dialog shows NuGet Version 3.5.0.0. In the Add-Ins > IDE extensions it is stated that NuGet Package Management/NuGet Packaging 6.3 are used. So XS itself uses NuGet3?

PS:
This link and this link suggest to download nuget.exe and run on Mac?

Best Answer

Answers

  • mattwardmattward GBMember Xamurai
    edited September 27

    Xamarin Studio includes its own set of NuGet libraries. Xamarin Studio does not include nuget.exe.

    If you need to use NuGet 3 or above you will need to download it from: https://www.nuget.org/downloads

    Then it is up to you whether you add a symlink/script to point to it or add it to your path and use mono to launch it or just put it next to your solution somewhere.

    Mono 5.4 ships with NuGet 4.3 but older Mono versions are still shipping with NuGet 2.12.

  • anveanve DEMember ✭✭

    @mattward:

    But the link you posted only includes Windows executables? How should that run on a Mac?

    I looked under the runtime environment and it seems I have Mono 5.2.0.224 installed. How or when would there be an upgrade to Mono 5.4? Can I do it myself?

Sign In or Register to comment.