.net 我无法在 Visual Studio 2017 中添加引用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45007007/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 09:57:16  来源:igfitidea点击:

I can't add reference in Visual Studio 2017

.netdll.net-corevisual-studio-2017

提问by Peter John Paul Tactacan

I'm having issues right now on adding reference in Visual Studio 2017. So basically, I clicked on my project to show the collapsed menu where you can see folders, properties, and references. I right clicked Referencesand chose Add reference. An error shows up and it says "The operation could not be completed. No such interface supported".

我现在在 Visual Studio 2017 中添加引用时遇到问题。所以基本上,我单击了我的项目以显示折叠菜单,您可以在其中查看文件夹、属性和引用。我右键单击References并选择Add reference。出现错误并显示“操作无法完成。不支持此类接口”。

I'm currently using Microsoft Visual Studio Community 2017 Version 15.2.

我目前使用的是 Microsoft Visual Studio Community 2017 版本 15.2。

回答by Peter John Paul Tactacan

This thread helps me resolve the issue:

这个线程帮助我解决了这个问题:

https://developercommunity.visualstudio.com/content/problem/28126/unable-to-add-reference-in-visual-studio-2017-refe.html

https://developercommunity.visualstudio.com/content/problem/28126/unable-to-add-reference-in-visual-studio-2017-refe.html

Just to sum it up, the thread says that I need to add a certain .dll file on the cache for me to add References. Not sure why this issue occur but I hope it helps anyone who encounters the same issue.

总结一下,该线程说我需要在缓存中添加某个 .dll 文件,以便我添加引用。不确定为什么会出现此问题,但我希望它可以帮助遇到相同问题的任何人。

回答by Robert Dara?

But remember, you have to add Microsoft.VisualStudio.Shell.Interop.11.0.dll not 12 or less than 11 for Visual Studio 2017 because it will not work.

但请记住,您必须为 Visual Studio 2017 添加 Microsoft.VisualStudio.Shell.Interop.11.0.dll 不为 12 或小于 11,因为它不起作用。

回答by RenniePet

The above answer didn't work for me. And despite me getting the same error message as the OP (and the person on the Microsoft forum), I was not getting any information in Visual Studio's ActivityLog.xml file.

上面的答案对我不起作用。尽管我收到了与 OP(以及 Microsoft 论坛上的人)相同的错误消息,但我在 Visual Studio 的 ActivityLog.xml 文件中没有得到任何信息。

I ended up having to pack my .dll in a NuGet package and add it to the project in that way. These links were helpful:

我最终不得不将我的 .dll 打包到 NuGet 包中,然后以这种方式将其添加到项目中。这些链接很有帮助:

https://www.jweiler.com/create-nuget-packages-with-vs-2017/

https://www.jweiler.com/create-nuget-packages-with-vs-2017/

https://stackoverflow.com/a/48549013/253938

https://stackoverflow.com/a/48549013/253938

回答by Buzz

I just realized I was selecting from the list of recent references, but not using the checkbox to the left of them. I'm an idiot. Or am I? Personally, I don't like how this selection works. Why are the unchecked checkboxes hidden until I select an item? Who does this? And besides, I can select like a normal listbox but also check. Very weird to me.

我刚刚意识到我是从最近的参考文献列表中进行选择,但没有使用它们左侧的复选框。我是个白痴。还是我?就个人而言,我不喜欢这种选择的工作方式。为什么在我选择一个项目之前,未选中的复选框会隐藏?谁做这个?此外,我可以像普通列表框一样选择,但也可以检查。对我来说很奇怪。