Find PublicKeyToken of a DLL

Introduction

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

Please see this article in my blog.

Background

Today I was trying to determine a public key of a DLL that I added to my MVC project. I learned that we can determine this by using our Visual Studio itself. Here I am sharing that information and will use Visual Studio 2012.

Using the code

To determine the DLL information, you need to run your project, since this process will work only in debug mode. You need to put a breakpoint 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 open, there you need to type the following:

  1. ?System.Reflection.Assembly.LoadFile(@"C:\SVenu\TestApp\TestApp\bin\CellSetGrid2.dll").FullName   

Then you can see the 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 the DLL by giving the following command.

  1. ?System.Reflection.Assembly.LoadFile(@"C:\SVenu\TestApp\TestApp\bin\CellSetGrid2.dll")  

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

Please note that the output given here will be different depending on your DLL.

Conclusion

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


Similar Articles