Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would Visual Studio give access denied, code 5 error when trying to build solution with NuGet packages?

I'm trying to build a Visual Studio solution that references NuGet packages. I've copied the solution from someone else's computer (via Git, but I don't know if the means of copying is important here). I keep getting this command when I try to build the solution:

Error 3 The command ""D:\Custom Work\MySolution\Project\.nuget\nuget.exe" install
    "D:\Custom Work\MySolution\Project\AAIA.Model\packages.config" -source ""
    -RequireConsent -o "D:\Custom Work\MySolution\Project\packages"" exited with code 5.
    Please verify that you have sufficient rights to run this command.

I've checked the permissions on all the folders, and they all seem to be fine. No sharing violations either; Visual Studio 2010 is the only program that is touching these files and folders. Why would this be happening?

like image 996
Paul d'Aoust Avatar asked Oct 04 '12 00:10

Paul d'Aoust


2 Answers

Your cloning solution may not be passing in windows 'execute' permission for the nuget.exe file.

If you are cloning using git clone in cygwin, then attempting to use visual studio to open and build, the permission will not have been properly set for nuget.exe. The 'linux' of it doesn't support windows' executable permission. If you clone using something like git-extensions you can avoid this problem since its built for windows and supports the executable permission.

like image 95
CarComp Avatar answered Oct 07 '22 00:10

CarComp


Or in my case the <solution root>\.nuget\nuget.exe file got corrupted.

  1. Delete the <solution root>\.nuget\nuget.exe file
  2. (re)enable NuGet package restore (VS2012 menu => "project" => enable nuget package restore)
like image 44
DeepSpace101 Avatar answered Oct 07 '22 00:10

DeepSpace101