简体   繁体   中英

Does GAC conflict with the Registry for Assembly Loading?

I have a DLL I generate from a C# project. I then register it via regasm so that the library can be used inside several legacy VB scripts.

Recently I created a new project (C# console app) that will reuse certain modular aspects of the original library, and per good programming practice it made sense to add the library to the GAC for reuse by this and any future projects.

I've found that it plays nice at first, but after the server is rebooted, the VB scripts crash and burn, claiming they are unable to create an object of one of the types defined in the library.

The fix involves removing the library from the GAC and re-registering the library via regasm .

  • The libraries in the registry and GAC come from the same physical DLL file - same directory and everything.
  • I've confirmed the existence of registry entries for the library every step of the way, which says regasm did its job.
  • GAC entries only exist when the library is installed, and properly disappear when it is uninstalled. They only ever appear under GAC_MSIL , where, to my knowledge, they should be.

Any ideas why this is happening?

I would guess you didn't renew the GUIDs and/or distinguish the fully qualified type names of the new library and when you installed it with regasm , the old entries in the registry got overwritten. Registering the old library again has overwritten the new library's registry, but as you don't use it through COM that didn't affect it and now the scripts work again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM