Do I need to force the GAC to reload an assembly? Is this possible?

ぐ巨炮叔叔 提交于 2019-12-13 04:12:50

问题


I've added types to my .NET classes that I'm using for COM interop. To get it to work with my VB6 application, I unregistered the DLL and re-registered it (using regasm). I then uninstalled and reinstalled it to the GAC (using gacutil).

The types are showing up in the VB6 object explorer, but when I run the application in the VB6 IDE, it breaks on the line that instantiates the new types with the error: Automation Errror - The System cannot find the file specified.

I thought this odd since I had already updated the GAC, so I uninstalled the dll from the GAC and got the exact same error, which seems to indicate that the older version of the dll is already in memory and needs to be "reloaded" so that the newer DLL is in memory. Is this possible, and if so, what do I need to do?


回答1:


I suspect that regasm.exe is adding COM entries for your objects and pointing them to teh location of the assembly before it was GAC'd. Normally that shouldn't make a difference as the GAC will win in all cases. But there could be a difference for COM interop.

Try digging through the registry and see where the COM entries are pointing to for your COM interfaces and make sure your assembly exists at that location.




回答2:


Try saving your VB6 project, closing the IDE and re-opening your project. That worked for me in this situation.



来源:https://stackoverflow.com/questions/3062754/do-i-need-to-force-the-gac-to-reload-an-assembly-is-this-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!