如何阻止Installer.Commit()运行?
我需要防止在我的 CustomActions 托管代码中运行 Installer.Commit 方法。 如果我只是在重写的 Commit 方法中不执行任何操作,它仍然会提交(它在程序和功能列表中创建一个元素),而我不希望这样。
如果我说 base.Commit(null) 它会停止,但会弹出一个错误。我怎样才能在没有任何消息的情况下默默地执行此操作?
我可以以某种方式更改savedState,这样它就不会真正提交安装吗?
I need to prevent of running Installer.Commit method in my CustomActions managed code.
If I just do nothing inside overrided Commit method, it still commits (it creates an element in Programs and Features list) and I don't want that.
If I say base.Commit(null) it stops, but popups an error. How can I do this silently without any messages?
Can I change savedState somehow so it wouldn't actually commit the installation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
提交并不负责将您的产品发布到 ARP。 Windows Installer 通过 PublishProduct 标准操作执行此操作,您可以使用 ARPSYSTEMCOMPONENT 属性禁用它,但您使用的安装创作工具实际上不会公开此操作(或 MSI 可以执行的任何其他操作)。
http://msdn.microsoft.com/en -us/library/aa367750(v=VS.85).aspx
如果您想拥有高质量的安装程序,则不应使用 VDPROJ 或 InstallUtil / InstallerClass 自定义操作。
The commit isn't what is responsible for publishing your product to ARP. Windows Installer does this via the PublishProduct standard action and you could disable it using the ARPSYSTEMCOMPONENT property except that the installation authoring tool that you are using doesn't actually expose this ( or just about anything else MSI can do ).
http://msdn.microsoft.com/en-us/library/aa367750(v=VS.85).aspx
If you want to have a high quality installer you shouldn't use VDPROJ or InstallUtil / InstallerClass custom actions.
在这种情况下,我没有找到任何解决方案,只能在 Commit() 之后删除注册表项。
中的所有密钥
我已删除HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\Products
其中 UninstalString 值包含 ProductCode (应用程序的 GUID)
我还从中删除了一个密钥
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 其中子项名称 == ProductCode
我猜还剩下一些东西。我不知道。
In this case I haven't found any solution but deleting the registry entries right after Commit().
I've deleted all the keys in
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\Products
where UninstalString value contains ProductCode (GUID of the app)
I also deleted a key from
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall where the SubKey name == ProductCode
I guess there is something left. I'm not sure.