Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 REGASM 之类的代码中注册 COM 可见的程序集?
背景: 我必须使用旧版 Delphi 5 应用程序部署 dll,但 DLL 是 C# 编写的,并且使 COM 可见。
有没有办法可以在代码中动态复制此功能(regasm xxx.dll),因为旧版应用程序是从网络路径启动的(所有客户端上都没有本地安装)。
谢谢
您可以使用/regfile命令行选项regasm,然后执行生成的.reg文件。
/regfile
regasm
.reg
我更喜欢使用reg.exe import "%s"而不是regedit.exe,因为它会避免弹出窗口。或者您可以编写自己的 .reg 解析器并更新注册表,但这可能过于复杂。
reg.exe import "%s"
regedit.exe
确保每个"CodeBase"="file://...."条目都将更改为包含 COM.dll包装器的预期(网络)文件夹。
"CodeBase"="file://...."
.dll