Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet - How to configure package restore on MonoDevelop/Xamarin Studio

Reading Using NuGet without committing packages to source control I've understood I should add the .nuget folder to my project to enable package restore during build... and reading Prepare a git repo for NuGet I've understood I could remove NuGet.exe and NuGet.config and let the IDE download them automatically by setting DownloadNuGetExe to true in NuGet.targets.

Well, I'm a bit confused since 1) Xamarin Studio does not download neither NuGet.exe nor NuGet.config... and 2) the .nuget folder is not necessary at all since one could just issue command Restore NuGet Packages on the solution explorer and the packages are restored anyway.

Having said that, what's the right way to configure package restore on Xamarin Studio/MonoDevelop?

like image 782
j3d Avatar asked Sep 28 '13 22:09

j3d


2 Answers

Or you can use the new package restore in 2.7. Just run

nuget.exe restore <your_solution_file>

to restore all packages used by the projects in the solution.

See http://docs.nuget.org/docs/reference/package-restore for details.

like image 112
Fei Ling Avatar answered Sep 24 '22 15:09

Fei Ling


Enabling package restore so it happens when the project is compiled is not possible using the NuGet addin for Xamarin Studio. It is something that I did not implement. If you want to do this you will have to add the files manually and edit the project to use the NuGet.targets file.

Personally I would instead use the Restore NuGet Packages menu option and not use the NuGet.targets file. One thing you lose here is triggering a package restore on every build however you only need to do it once. You also get some benefits of using this approach:

  1. Your project does not need to be modified.
  2. All NuGet packages will be restored before XBuild is run so any NuGet packages that have their own custom XBuild imports will be restored and available at compile time.
like image 35
Matt Ward Avatar answered Sep 24 '22 15:09

Matt Ward