How to find PublicKeyToken of a DLL

Introduction

In this article we will learn how we can find out the public key token of a DLL that we add as a reference in our project . I hope you will like it.

Background

Today I was trying to find out a public key of a dll that I added to my MVC project. I came to know that we can find out this by using our visual studio itself. Here by I am sharing you that information. I am using Visual Studio 2012.

Using the code

To find out the DLL information, you need to run your project, since this process will work only in debug mode. you need to put a break point somewhere in your cs page.

And when the break hits, you need to go to the immediate window by pressing Alt+Ctrl+I .

Now a window will be opening, there you need to type
[csharp]
?System.Reflection.Assembly.LoadFile(@"C:\SVenu\TestApp\TestApp\bin\CellSetGrid2.dll").FullName
[/csharp]

Then you can see output in the immediate window as follows.

If you are not in debug mode or you are in design mode, you will get a warning as follows.

The expression cannot be evaluated while in design mode.

You can always check the entire details of DLL by giving the following command.

[csharp]
?System.Reflection.Assembly.LoadFile(@"C:\SVenu\TestApp\TestApp\bin\CellSetGrid2.dll")
[/csharp]

Then you can see output in the immediate window as follows.

Please be noted that the output given here will be different according to your DLL

Conclusion

That is all. I hope you liked this article. Please share me your feedback.

Kindest Regards
Sibeesh Venu

Leave a Reply

Your email address will not be published. Required fields are marked *

Serverless 360