How do I add a modified dll to the Global Assembly

2019-08-16 00:24发布

问题:

I have the MySQL Connector/NET installed on my PC. I modified the source code and recompiled one of the dlls (MySQL.Data.dll). With the program already installed, how can add this dll to the Global Assembly Cache?

If your answer involves using gacutil.exe, please tell me where I can find it on my PC or where I might download it. Thanks!

回答1:

You can put it in the GAC but unless you have access to the private key with which it was originally signed, the installed program(s) will not recognize it.



回答2:

Open Windows Explorer (WindowsKey+E). Go to c:\windows\assembly. Open a second explorer window and drag and drop your assembly to the first window.



回答3:

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe" /i "strongnamed.dll" /f /nologo


回答4:

Very simple: Start-> Programs-> Microsoft Visual Studio 2005/2008 -> Visual Studio Tools -> Visual Studio 2005/2008 command prompt

a cmd appears, where you can type gacutil.

It also shows you the path where it resides:

C:\Program Files\Microsoft Visual Studio 9.0\VC> on my computer.



回答5:

  1. Open Visual Studio Command Prompt

First open Visual Studio Command Prompt (For Visual Studio 2010 the path is Programs --> Visual Studio 2008 --> Visual Studio Tools --> Visual Studio 2008 Command Prompt ) All the files mentioned in the following steps will be created in the Visual Studio 2010 Command Prompt Path.

  1. Generate a KeyFile sn -k keyPair.snk
  2. Get the MSIL for the assembly ildasm SomeAssembly.dll /out:SomeAssembly.il
  3. Rename the original assembly, just in case ren SomeAssembly.dll SomeAssembly.dll.orig
  4. Build a new assembly from the MSIL output and your KeyFile ilasm SomeAssembly.il /dll /key=keyPair.snk
  5. Install the DLL in to the GAC gacutil -i SomeAssembly.dll