简体   繁体   中英

Execution problems in visual studio for Mac 2019 (NuGet packages)

I want to use C# in Visual Studio but I cannot execute any C# projects

And it just shows the error, which says "Failed to read NuGet.Config due to unauthorized access. Path ...." also says "you should restore the NuGet Packages before build..."

I don't know how to solve this problem, how to restoring packages.. and able to make access authorized...

错误信息

the image when opening the project at first, the content in the green box tells all in that error message

Actually it is not about the code, the point is I cannot do anything due to the error above.

I found what was wrong in this problem.

Actually, from the error messages it was the point that VS cannot read NuGet.Config file in NuGet Directory in .config! And (I am not sure exactly) VS could not make NuGet directory in my .config directory due to some access problems! So I make the NuGet directory like below picture by myself and now VS successfully restore the NuGet Packages!

在此处输入图片说明

I took a long time at this "simple" problem. I hope the others with same problem above not to waste pretty much time like me..

For macOS Big Sur the solution is easier. Because Visual Studio is not an Apple program you should give it full disk access in System Preferences > Security & Privacy

For Mac OS: Create Nuget folder inside .config folder.
.config is a hidden folder so access then using cmd + shift + . . And change the permissions of the config folder by right clicking on .config ->Get Info

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM