Asp.net
為什麼在嘗試使用 NuGet 包建構解決方案時,Visual Studio 會給出拒絕訪問、程式碼 5 錯誤?
我正在嘗試建構一個引用 NuGet 包的 Visual Studio 解決方案。我已經從別人的電腦上複製了解決方案(通過 Git,但我不知道複製的方法在這裡是否重要)。當我嘗試建構解決方案時,我不斷收到此命令:
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.我檢查了所有文件夾的權限,它們似乎都很好。也沒有共享違規;Visual Studio 2010 是唯一涉及這些文件和文件夾的程序。為什麼會發生這種情況?
您的複製解決方案可能沒有傳遞 nuget.exe 文件的 Windows“執行”權限。
如果您在 cygwin 中使用 git clone 進行複製,然後嘗試使用 Visual Studio 打開和建構,則不會為 nuget.exe 正確設置權限。它的“linux”不支持windows的可執行權限。如果您使用 git-extensions 之類的東西進行複製,則可以避免此問題,因為它是為 Windows 建構的並支持可執行權限。
或者在我的情況下,
<solution root>\.nuget\nuget.exe文件已損壞。
- 刪除
<solution root>\.nuget\nuget.exe文件- (re)enable NuGet package restore (VS2012 menu => “project” => enable nuget package restore)