I recently visited MSDN and saw this article, which is very practical! Especially for sharepoint developers, how practical this applet is!
All users who do sharepoint development know that sometimes, or often need to obtain the Assembly's public key and all information about the Assembly. For example, if you want to register EventHandler, you must register a security control in the configuration file! All information about the Assembly is required!
Before that, we generally used two methods: (today we will introduce the third method)
1. Copy the assembly to the GAC directory, right-click to view the Assembly's public key, right-click to view properties.
2. Use the powerful Reflector tool. Drag the Assembly into the Reflector tool and you will see:
3. I always feel a waste of time. I always have to perform the operation several times. It's not good! I didn't know the following method before, and it was just like that...
Create a console application GetAssemblyFullName: Enter the following code:
Using System; using System. IO; using System. reflection; namespace GetAssemblyFullName {class Program {static void PrintUsage () {Console. writeLine ("Usage: GetAssemblyName.exe <path and filename> \ n"); Console. writeLine (@ "Example: GetAssemblyName.exe C: \ MyAssembly. dll "); Console. read ();} static void Main (string [] args) {if (args. length <1 | args [0] = "? ") {PrintUsage (); return;} string filename = args [0]; try {AssemblyName an = AssemblyName. getAssemblyName (filename); Console. writeLine ("assembly Full name: \ n"); Console. writeLine (. toString ();} catch (FileNotFoundException) {Console. writeLine ("the Assembly cannot be loaded. Make sure that the project has been compiled! ") ;}Console. Read ();}}}
Generate a project and copy the getassemblyfullname.exe application to a certain location, such as C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ Tools \
Open the VS tool:
In Visual Studio, select "external tools" from the "Tools" menu ".
In the "external tools" dialog box, click "add" and enter "Get Assembly full name" for "title.
Navigate to GetAssemblyFullName.exe and fill in the "command" text box.
In the parameter text box, type the following content (case sensitive): $ (TargetPath)
Enable the "use output window" check box.
Click OK ". The new command is added to the tool menu.
Compile the project once, and click tools on the menu bar. You will see the "get Assembly full name" option:
The input window of vs is displayed, and replication is also supported: Is it easier than the previous two methods? ...
Technorati labels: gac, sharepoint, dll
Link: http://msdn.microsoft.com/zh-cn/library/ee539422.aspx#Y100