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

Reading Using NuGet without transferring packages to the source control I realized that I had to add the .nuget folder to my project to enable package recovery during build ... and reading Prepare the git repository for NuGet . I realized that I can 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 little confused, because 1) Xamarin Studio does not load either NuGet.exe or NuGet.config ... and 2) the .nuget folder is not needed at all, because you can simply issue the Restore NuGet Packages command in the solution explorer and that's it packages will be restored.

Having said that, what is the right way to configure package recovery on Xamarin Studio / MonoDevelop?

+6
source share
2 answers

Enabling package recovery so that this happens when the project has been compiled is not possible by adding NuGet to Xamarin Studio. This is something that I have not implemented. If you want to do this, you will have to manually add files and edit the project to use the NuGet.targets file.

Personally, I will use the Restore NuGet Packages option instead and will not use the NuGet.targets file. One thing you lose here is to start a package recovery on each assembly, but you only need to do this once. You also get some benefits from using this approach:

  • Your project does not need to be changed.
  • All NuGet packages will be restored before XBuild starts, so any NuGet packages that have their own custom XBuild imports will be restored and available at compile time.
+3
source

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

 nuget.exe restore <your_solution_file> 

to restore all packages used by projects in the solution.

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

+3
source

Source: https://habr.com/ru/post/954860/


All Articles