[英]How to see the c# code detail in visual studio using F12?
I'm the new of c#
and visual studio. 我是
c#
和Visual Studio的新手。 when I use the F12 to go to definition, but sometime it didn't work. 当我使用F12进行定义时,但有时不起作用。 it just showed me the a code without the body/logic of the methods.
它只是向我展示了一个没有方法的主体/逻辑的代码。
Someone told me because of dll
, but I really don't know how to do can see the detailed code in this case. 有人因为
dll
告诉我,但是我真的不知道该怎么办才能看到这种情况下的详细代码。 Thanks. 谢谢。
As others said, it's because all VS has to go on is the DLL, which doesn't contain the source, only method signatures. 正如其他人所说,这是因为所有VS都必须继续执行DLL,该DLL不包含源代码,而仅包含方法签名。
But what can you do about it? 但是你能做什么呢?
A few things. 一些东西。
This is because you didn't add reference as a project but you are pointing to a dll
or exe
using Browse tab in Add Reference dialog. 这是因为您没有将引用添加为项目,而是使用“添加引用”对话框中的“浏览”选项卡指向
dll
或exe
。 If you add reference using Projects tab you should go directly to the source code when you select Go To Definition. 如果使用“项目”选项卡添加引用,则在选择“转到定义”时应直接转到源代码。
Note: If you do not have project for the
dll
then you will getmetadata
only fromdll
注意:如果您没有
dll
专案,那么您只会从dll
取得metadata
If your definition you are going to find using F12 is in the same project, then it will show total definition of method/variable/class. 如果您要使用F12查找的定义在同一项目中,则它将显示方法/变量/类的总定义。
If your definition is outside the project i,e you are referencing different project, then it will show only declaration. 如果您的定义在项目之外,即您引用的是其他项目,那么它将仅显示声明。
如果尝试从编译的DLL中查看所引用方法的源代码,则不能,因为它是编译后的代码,因此不是源代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.