visual-studio 当 /u arg 不起作用时,如何取消注册最初使用 RegSvr32 添加的 COM dll?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19725/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:22:53  来源:igfitidea点击:

How do I unregister COM dlls initially added with RegSvr32 when the /u arg doesn't work?

visual-studiocomregsvr32dllregistration

提问by Chris Skardon

Right, initially ran:

对,最初运行:

c:\regsvr32 Amazing.dll

then, (accidentally - I might add) I must have run it again, and (indeed) again when new versions of 'Amazing.dll' were released. Yes - I know nowI should've run:

然后,(偶然地 - 我可能会补充)我必须再次运行它,并且(确实)在新版本的“Amazing.dll”发布时再次运行。是的 - 我现在知道我应该跑:

c:\regsvr32 /u Amazing.dll

beforehand - but hey! I forgot.

事先 - 但是嘿!我忘了。

To cut to the chase, when add the COM reference in VS, I can see 3 instances of 'Amazing' all pointing to the same location (c:\Amazing.dll), running regsvr32 /uremoves one of the references, the second time - does nothing...

切入正题,当在 VS 中添加 COM 引用时,我可以看到 3 个“Amazing”实例都指向同一位置(c:\Amazing.dll),regsvr32 /u第二次运行会删除其中一个引用 - 是否没有...

How do I get rid of these references? Am I looking at a regedit scenario? - If so - what exactlyhappens if I delete one of the keys???

我如何摆脱这些引用?我在看 regedit 场景吗?- 如果是这样 -如果我删除其中一个键到底会发生什么???

Cheers

干杯

采纳答案by Scott Marlowe

Your object's GUID's should not be changing. In other words, once you register the COM object, re-registering shouldn't be adding anything additional to the registry.

您的对象的 GUID 不应更改。换句话说,一旦您注册了 COM 对象,重新注册就不应该向注册表中添加任何其他内容。

Unless you added additional COM interfaces or objects to the project.

除非您向项目添加了额外的 COM 接口或对象。

In any case, if this is a one time deal (and it sounds like it is), open regedit and delete the unneeded keys manually.

无论如何,如果这是一次性交易(听起来确实如此),请打开 regedit 并手动删除不需要的密钥。

回答by Shaun Austin

There's a tool by MS that is still floating around and has been since Win95 days which scans the registry and does stuff like finds COM keys that aren't pointing at a valid file anymore etc called RegClean (I found it here: http://downloads.zdnet.com/abstract.aspx?assetid=881470&node=2094) which I've seen some places still using particularly when messing with legacy COM stuff in VB which are generating new COM GUIDs after every build.

MS 有一个工具仍然存在,并且自 Win95 以来一直存在,它会扫描注册表并执行诸如查找不再指向有效文件的 COM 键等操作,称为 RegClean(我在这里找到了它:http:// downloads.z​​dnet.com/abstract.aspx?assetid=881470&node=2094),我已经看到一些地方仍在使用,特别是在与 VB 中的遗留 COM 内容混淆时,每次构建后都会生成新的 COM GUID。

So if you got that, then unreg'd and deleted or moved the file, run the app and it will clean out the "orphaned" entries.

所以如果你得到了那个,然后取消注册并删除或移动文件,运行应用程序,它会清除“孤立”条目。

If you do decide to remove the keys using RegEdit, you might need to remove the class ids as well as the guid entries.

如果您决定使用 RegEdit 删除密钥,则可能需要删除类 ID 以及 guid 条目。

回答by Johnno Nolan

I've got myself into a horrible mess with COM before. I had to pick my way though the registry deleting each reference, unfortunately.

之前我已经把自己搞得一团糟。不幸的是,尽管注册表删除了每个引用,但我不得不选择自己的方式。