大规模部署用 C# .NET 4.0 编写的托管 ActiveX 控件
我已经用 C# (.NET 4.0) 创建了一个托管 ActiveX 控件,该控件由 Office VBA 访问(当前从 Dynamics 中的 VBA 代码调用)。然而,当寻找一种方法将其部署到我们公司的大众(并保持更新)时,我找不到有效的方法来做到这一点。
起初,我认为我可以通过 ClickOnce 以某种方式做到这一点,但在阅读了一些文章后,我认为这行不通。
有什么建议吗?也许是 PowerShell?
当我们添加新功能时,我需要经常更新此控件。
任何建议都非常受欢迎。
感谢您抽出时间,
罗布
I have created a managed ActiveX control in C# (.NET 4.0) that is accessed by Office VBA (currently being called from VBA code in Dynamics). However, when looking for a method to deploy this to the masses in our company (and keep it updated), I cannot find an efficient way of doing this.
At first, I thought that I could do this somehow through ClickOnce, but after reading some articles, I don't think this will work.
Are there any suggestions? PowerShell perhaps?
I will need to update this control somewhat frequently as we add new functionality.
Any advice is greatly welcomed.
Thanks for your time,
Rob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在还不排除 ClickOnce。 ClickOnce 的问题在于它是按用户安装应用程序,而不是按计算机/系统范围安装应用程序。由于 COM/ActiveX 注册通常是计算机/系统范围的,即注册表项位于 HKLM 下,因此 ClickOnce 不支持它(由于修改注册表的 HKLM 部分需要权限)。
但从 Windows 2000 开始,可以在注册表的用户部分注册 COM 对象:
HKEY_CURRENT_USER\Software\Classes
映射到HKEY_LOCAL_MACHINE\SOFTWARE\Classes
,这与HKEY_LOCAL_MACHINE\SOFTWARE\Classes
相同代码> HKEY_CLASSES_ROOT。因此,使用类似 RegSvrEx 的内容,您应该能够确定所需的注册表项在
HKCU
下创建。完成此操作后,请找到一种在发生 ClickOnce 安装/更新时触发此 HKCU 注册表更新的方法。Don't rule out ClickOnce just yet. The issue with ClickOnce is that it installs apps per-user rather than per-machine/system-wide. Because COM/ActiveX registration is typically machine/system wide, i.e. the registry entries are under HKLM, ClickOnce doesn't support it (due to permissions required to modify the HKLM part of the registry).
But since Windows 2000 it's possible to register COM objects in the user part of the registry:
HKEY_CURRENT_USER\Software\Classes
maps toHKEY_LOCAL_MACHINE\SOFTWARE\Classes
which is the same asHKEY_CLASSES_ROOT
.So, using something like RegSvrEx you should be able to ascertain the registry entries you need to create under
HKCU
. When you've done this, find a way of triggering this HKCU reg update when the ClickOnce install/update happens.您可以使用
regasm.exe
实用程序:其中
foo.dll
是包含要公开的 ActiveX 控件的托管程序集。You could use the
regasm.exe
utility:where
foo.dll
is the managed assembly containing the ActiveX control that you want to expose.