Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet Package Restore in MonoDevelop on OSX/Linux

I'm trying to compile a Visual Studio project with NuGet package restore under MonoDevelop but it's not working out of the box.

NuGet should work on Mono and there's even support built into nuget.targets, so what is missing?

like image 923
Johannes Rudolph Avatar asked Apr 20 '13 08:04

Johannes Rudolph


People also ask

How do I force a NuGet package to restore?

Restore packages manually or automatically After you enable package restore in Options, you can right-click the solution in Solution Explorer and select Restore NuGet Packages to restore packages anytime.

How do I fix NuGet recovery failed?

Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.

How do I install NuGet packages missing?

To update all packages in your solution, first restore them, and then you can either use NuGet.exe to update the packages, or you can update the packages from the Package Manager Console window within Visual Studio (see below), or finally you can use the Manage Packages dialog.

Where is .NuGet linux?

NuGet cache is typically located in ~/. local/share/NuGet/Cache while dnu cache is located in ~/. local/share/dnu/cache .


1 Answers

Based on issue tracked here: https://nuget.codeplex.com/workitem/3278

  1. You must use xbuild with all projects that should restore packages on build. MonoDevelop->Preferences->Build Enable xbuild in MonoDevelop or Xamarin Studio
  2. Unix filesystems are case-sensitive. This breaks nuget.targets as the casing inside the file is assumed to be all lower case whereas the files added to a solution in the .nuget folder are cased like "NuGet". Either fixup nuget.targets or change the filenames in your solutions .nuget folder to all lower case.
  3. RequireRestoreConsent is true by default in nuget.targets. Edit nuget.targets and change it to false.
  4. Package restore puts the package folder in a weird location, $(SolutionDir)/ /packages (yes, theres a single whitespace folder in between). The reason is that there's a trailing whitespace in nuget.targets in after $(SolutionDir) in <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
like image 190
Johannes Rudolph Avatar answered Sep 21 '22 18:09

Johannes Rudolph