0

我更新了自定义 .Net 组件,但忘记先取消注册以前的版本。

我没有取消注册,而是将新的 dll 复制到旧版本上。

组件向 COM 公开,现在我在经典 ASP 页面上收到“无法创建对象”消息。

我猜旧的组件信息保留在注册表或系统其他地方的某个地方。有没有办法在没有实际 dll 的情况下删除/卸载/注销这些信息?

我尝试使用 Regasm 工具取消注册组件,但现在我只能提供新 dll 的路径,因为旧 dll 已被覆盖。

还有其他方法可以从系统中删除旧版本信息并仅注册新的 dll 吗?

谢谢!

4

1 回答 1

1

Forgetting to unregister an assembly only leaves junk in the registry. Which is sloppy and very hard to get rid of but certainly not the end of the world. Many older machines have lots of junk like that, the kind of junk that a registry cleaner professes to get rid of. This is not an endorsement of tools like that btw.

It doesn't prevent an updated assembly from working correctly. Assuming you did it right and ran Regasm.exe correctly, used the /codebase option so you don't hassle the GAC and also updated the type library reference in your ASP project. The latter being the typical step that's overlooked, it might still use the old registration keys.

A counter-measure is to (temporarily) use the [Guid] attribute on the interface and class declarations. So that the registry keys that are used for registering the component are always the same. You can't add junk in the registry that way, an update will always overwrite the same keys. You can even skip the registration step on an update, assuming you didn't add any interfaces or classes or changed the path of the DLL.

You should however removed those [Guid] attributes again after the project stabilizes and you're about to ship. Not doing so invokes DLL Hell, nothing to mess with.

The Regasm.exe /regfile option is notable. You can see what registration keys are being used.

于 2013-06-05T12:15:12.380 回答