简体   繁体   English

VS2017 nuget无法加载项目依赖项

[英]VS2017 nuget failed to load project dependencies

I'm having this particular problem in the recent version of VS2017 (15.5.3). 我在最新版本的VS2017(15.5.3)中遇到了这个特殊问题。 Even when I create a fresh new solution, using AspNet.Core template for example, I'm getting this Nuget resolving dependency error in Solution Explorer right after opening that particular (new) solution. 即使我创建一个全新的解决方案,例如使用AspNet.Core模板,我在打开特定(新)解决方案后立即在解决方案资源管理器中获得此Nuget解决依赖性错误。 And it's not only for Nuget remote packages, it behaviors the same even with project references which causes me an extra problem as I cannot use intelisense (for libraries out of the current one) and other VS fancy features because of that. 而且它不仅适用于Nuget远程软件包,它的行为也相同,即使项目引用也会导致我一个额外的问题,因为我不能使用intelisense(对于当前的库以外的库)和其他VS花哨功能。 On the other hand if I run dotnet restore command everything works just fine so the problem is in Visual Studio I guess and not with dotnet core in general. 另一方面,如果我运行dotnet restore命令一切正常,所以问题出在Visual Studio中我猜,而不是一般的dotnet核心。 Also dotnet build and dotnet publish also work like a charm. dotnet build和dotnet发布也像魅力一样工作。

And this is the specific error message I usually get when I try to restore nuget packages by right-clicking on the solution: Error occurred while restoring NuGet packages: The operation failed as details for project "x" could not be loaded. 这是我通过右键单击解决方案尝试恢复nuget包时通常会得到的特定错误消息:恢复NuGet包时出错:操作失败,因为无法加载项目“x”的详细信息。

Just to mention, I've tried reinstalling Visual Studio, both Comunity and Enterpise edition, and that went without luck too. 我只想提一下,我已经尝试重新安装Visual Studio,包括Comunity和Enterpise版本,这也没有运气。 And what is very interesting, all teammates got the very same version of Visual Studio and solution itself and they are not facing the same issue. 而且非常有趣的是,所有队友都获得了相同版本的Visual Studio和解决方案本身,并且他们没有遇到同样的问题。

Any idea what could be a possible solution? 知道什么是可能的解决方案吗? Anyone faced the same issue? 有人遇到同样的问题吗? I've tried solutions from this post but none works for me: VS2017 The operation failed as details for project could not be loaded . 我已尝试过这篇文章的解决方案,但没有一个对我有用VS2017由于无法加载项目的详细信息,操作失败

Thanks. 谢谢。

I got in a similar situation 我遇到了类似的情况

  • VS2017 (15.5.6). VS2017(15.5.6)。
  • "The operation failed as details for project 'x' could not be loaded" for a .Net Core project. 对于.Net Core项目, 无法加载项目'x'的详细信息,操作失败”
  • dotnet restore command seemed to wor at first, but errors remained. dotnet restore命令起初似乎很烦人,但错误仍然存​​在。
  • Also, the special folder Dependencies was marked with a yellow "warning" icon in each project. 此外,特殊文件夹Dependencies在每个项目中都标有黄色“警告”图标。

Searching for bugs in NuGet related to this, I found this post ( https://developercommunity.visualstudio.com/content/problem/160750/nuget-bug-in-vs155.html ). 在NuGet中搜索与此相关的错误,我发现了这篇文章( https://developercommunity.visualstudio.com/content/problem/160750/nuget-bug-in-vs155.html )。

The problem (and the workaround) turned out to be very simple. 问题(和解决方法)变得非常简单。 The project was located under a folder with a "special character" in the name, such as C:\\Projects\\A&B\\ . 该项目位于名称中包含“特殊字符”的文件夹下,例如C:\\ Projects \\ A&B \\ I just removed the "&" character in the folder name ( C:\\Projects\\AB\\ ), reopened the solution, and everything seems to be working just fine now. 我刚刚删除了文件夹名称中的“&”字符( C:\\ Projects \\ AB \\ ),重新打开了解决方案,现在一切正常。

I hope this helps. 我希望这有帮助。

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

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