.NET转到NuGet包的实现 [英] .NET Go To Implementation of a NuGet package
问题描述
有人知道有什么方法/工具可以让我浏览实现来自NuGet包的方法/类型(通过拥有原始的 PDB 或获取它们的 URL ).
Is anyone aware of a method/tool that would allow me to browse the implementation of a method/type that comes from a NuGet package (by having the original PDBs or a URL of where to get them).
我知道 SourceLink ,我实际上,我正在使用它.但是,源链接是调试器功能,允许它在调试时下载源代码.我需要能够在不调试的情况下浏览源代码.(以某种方法打F12来表示.)
I am aware of SourceLink, and I am, in fact, using it. However, source linking is a debugger feature that allows it to download source code while debugging. I need to be able to browse my source code without debugging. (Say by hitting F12 on some method).
很奇怪,SourceLink下载了原始源的副本,所以我只需要链接Visual Studio指向源文件即可.
Weirdly, SourceLink downloads a copy of the original source, so I only need to link visual studio to point to the source file.
我尝试使用 JetBrains 中的 dotPeek ,但我只是设法使其用作符号服务器,这再次很有帮助-但仅在调试时使用.
I tried using dotPeek from JetBrains, but I only manged to get it working as a symbol server, which is again helpful - but only while debugging.
推荐答案
您应该能够使用JetBrains Resharper做到这一点.
You should be able to do that with JetBrains Resharper.
如果您的代码使用的是来自NuGet程序集的接口-或来自非您自己的任何程序集的接口-您必须在感兴趣的方法上按F12-转到定义-.这将导航至源代码接口的
.然后,您必须Ctrl + F12-转到实现-转到此程序集中该接口的实现.
据我所知,您不能直接在代码中使用Ctrl + F12,因为它只会在代码中搜索实现.
If your code is using an interface from a NuGet assembly - or from any assembly that is not your own - you have to press F12 - Go to definition - on the method you are interested in. This will navigate to the source code of the interface.
Then, you have to Ctrl + F12 - Go to implementation - to go to the implementation(s) of that interface in this assembly.
As far as I know, you can't use Ctrl + F12 directly from your code, because it would only search for implementations in your code.
这篇关于.NET转到NuGet包的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!