SangilMo
SangilMo

Reputation: 23

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...

error message

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.

Upvotes: 0

Views: 3356

Answers (4)

K. B.
K. B.

Reputation: 3690

I had this error because the Nuget.config was created using admin account, so I could not change its content with "normal" user account. Once I used admin, the error was gone.

Upvotes: 0

Junu Brahma
Junu Brahma

Reputation: 11

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

Upvotes: 1

Aart Spilt
Aart Spilt

Reputation: 11

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

Upvotes: 1

SangilMo
SangilMo

Reputation: 23

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!

enter image description here

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..

Upvotes: 1

Related Questions