How to add a dll to gac in vista

2019-02-17 09:37发布

When I drag & drop a dll to the assembly folder on vista, I get the error "Access is denied: mydll.dll". How can I bypass the error message and add my dll to gac?

6条回答
何必那么认真
2楼-- · 2019-02-17 10:08

Use runas command to run gacutil as a user with local admin rights to register the dll to GAC.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-02-17 10:09

Using Command line, use the following steps:

Open Visual Studio Command Prompt

First open Visual Studio Command Prompt (For Visual Studio 2008 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 2008 Command Prompt Path. In my case it is C:\Program Files\Microsoft Visual Studio 9.0\VC

  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
查看更多
我命由我不由天
4楼-- · 2019-02-17 10:13

The assembly (dll) also needs to be strongly named if it's going to reside in the GAC.

http://msdn.microsoft.com/en-us/library/wd40t7ad(VS.80).aspx

查看更多
叛逆
5楼-- · 2019-02-17 10:14

You can do that with gacutil.exe. It is located in:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

It is only there though, if you installed the .NET SDK (not just the .Net Redistributible). But you can copy it from your developer machine.

查看更多
Fickle 薄情
6楼-- · 2019-02-17 10:20

My guess would be that you have to do it as an administrator...try either disabling UAC, or using gacutil.exe to add your assembly.

查看更多
\"骚年 ilove
7楼-- · 2019-02-17 10:24

You may not locate gacutil.exe in your windows folder while using vista. It's not included because of vista's "Logo Program blah blah" thing. Try to use windows installer to add your assemblies into gac. This is the recommended way.

And never forget this traditional ogrish proverb: "Bi siktir git cay koy".

查看更多
登录 后发表回答