简体   繁体   English

Visual Studio for Mac 2019 中的执行问题(NuGet 包)

[英]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我想在 Visual Studio 中使用 C#,但我无法执行任何 C# 项目

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..."它只显示错误,它说“由于未经授权的访问,无法读取 NuGet.Config。路径......”还说“你应该在构建之前恢复 NuGet 包......”

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!实际上,从错误消息来看,VS 无法读取 .config 中 NuGet 目录中的 NuGet.Config 文件! And (I am not sure exactly) VS could not make NuGet directory in my .config directory due to some access problems!并且(我不确定)由于某些访问问题,VS 无法在我的 .config 目录中创建 NuGet 目录! So I make the NuGet directory like below picture by myself and now VS successfully restore the NuGet Packages!所以我自己制作了如下图所示的NuGet目录,现在VS成功恢复了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.对于 macOS Big Sur,解决方案更简单。 Because Visual Studio is not an Apple program you should give it full disk access in System Preferences > Security & Privacy由于 Visual Studio 不是 Apple 程序,因此您应该在“系统偏好设置”>“安全性和隐私”中为其提供完整的磁盘访问权限

For Mac OS: Create Nuget folder inside .config folder.对于 Mac OS:在.config文件夹中创建 Nuget 文件夹。
.config is a hidden folder so access then using cmd + shift + . .config是一个隐藏文件夹,所以访问然后使用cmd + shift + . . And change the permissions of the config folder by right clicking on .config ->Get Info并通过右键单击.config -> Get Info 更改 config 文件夹的权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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