简体   繁体   English

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

[英]I can't add reference in Visual Studio 2017

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 . 我现在在Visual Studio 2017中添加引用时遇到问题。所以基本上,我点击了我的项目以显示折叠菜单,您可以在其中查看文件夹,属性和引用 I right clicked References and chose Add reference . 我右键单击引用并选择添加引用 An error shows up and it says "The operation could not be completed. No such interface supported". 出现错误并显示“操作无法完成。不支持此类接口”。

I'm currently using Microsoft Visual Studio Community 2017 Version 15.2. 我目前正在使用Microsoft Visual Studio Community 2017版本15.2。

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. 总而言之,线程说我需要在缓存上添加某个.dll文件,以便我添加引用。 Not sure why this issue occur but I hope it helps anyone who encounters the same issue. 不确定为什么会出现这个问题,但我希望它可以帮助遇到同样问题的人。

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

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. 我最终不得不将我的.dll打包在NuGet包中并以这种方式将其添加到项目中。 These links were helpful: 这些链接很有帮助:

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

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. 对我来说很奇怪。

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

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