简体   繁体   English

Visual Studio安装程序安装项目从自定义操作执行回滚

[英]Visual studio installer setup project perform rollback from custom action

I have a setup project created with visual studio installer. 我有一个使用Visual Studio安装程序创建的安装项目。 I have set some custom actions that will start my custom-made WPF installer after the files are copied for further installation. 我设置了一些自定义操作,这些操作将在复制文件以进行进一步安装后启动我的自定义WPF安装程序。 But I have 2 problems: 但是我有两个问题:

  1. Even if I have disabled all windows, there's still a little loading bar from the msi that stays behind my WPF process that I'm starting from a custom action (not that big of a deal, I can live with that). 即使我禁用了所有窗口,MSI仍然有一点加载栏,它是我从自定义操作开始的WPF进程的后面(没什么大不了的,我可以接受)。 The UI level is 3, and the one from silent install is 2 (which is minimum). UI级别是3,静默安装的UI级别是2(最低)。 I was wondering if there's a way to set the default UI level to 2 (silent no matter what, even when the user double clicks the msi) 我想知道是否有一种方法可以将默认UI级别设置为2(无论什么情况,即使用户双击msi,它都保持静音)

  2. This is the biggest problem: The custom action starts my WPF process and waits for exit. 这是最大的问题:自定义操作将启动我的WPF进程并等待退出。 If the user cancels the installation (presses the X button in the WPF), the WPF will exit with a certain exitcode that I catch in my custom action. 如果用户取消安装(按WPF中的X按钮),则WPF将以我在自定义操作中捕获的某个退出代码退出。 Now, i need a way to perform a rollback from my custom action in this case. 现在,在这种情况下,我需要一种从自定义操作执行回滚的方法。 The only way i have found is to throw an exception. 我发现的唯一方法是引发异常。 But the user will then see the ugly dialog window from the msi with the exception, and I definitely don't want that. 但是用户会从msi看到丑陋的对话框窗口,但我绝对不希望这样。 Can I force the rollback somehow without throwing the exception? 我能以某种方式强制回滚而不抛出异常吗? Or at least hide the msi's UI? 或者至少隐藏了微星的用户界面?

Note: the custom action I'm using is the Committed event, because i need all the files to be copied (including some assemblies in GAC) for my WPF to work. 注意:我正在使用的自定义操作是Committed事件,因为我需要复制所有文件(包括GAC中的某些程序集),WPF才能起作用。

I have found a couple of answers on stackoverflow, but none of them were helpful. 我在stackoverflow上找到了几个答案,但是它们都没有帮助。 The closest one was this: 最接近的是:

Similar question 类似问题

Thank you 谢谢

You say you have a custom action that starts your WPF program, but you don't say what that code is, whether is NET, VBScript, C++ etc. If that's what's throwing the exception you should show thaqt code. 您说您有一个启动WPF程序的自定义操作,但是您没有说该代码是什么,无论是NET,VBScript,C ++还是其他。如果这是引发异常的原因,则应显示该代码。

If it's managed code you throw an InstallException with your message, that's just the way they work because managed code CAs are not native to Windows Installer so there's a shim Dll that deals with stuff. 如果是托管代码,则会在消息中抛出InstallException,这就是它们的工作方式,因为托管代码CA不是Windows Installer固有的,因此有一个填充程序Dll处理内容。

If the CA that calls your WPF program is C++ or VBScript then there is an API to show your own message, MsiProcess4essage or session.message. 如果调用您的WPF程序的CA是C ++或VBScript,则有一个API可显示您自己的消息MsiProcess4essage或session.message。

Generally speaking I don't believe you can force a rollback and suppress all messages - a message is always produced. 一般来说,我不认为您可以强制回滚并禁止显示所有消息-始终会生成一条消息。 It seems unfriendly to completely rollback the uninstall and uninstall everything without sayting what's going on. 完全回滚卸载并卸载所有内容而不声明正在发生的事情似乎是不友好的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio安装项目中从自定义操作设置应用程序文件夹 - Set Application Folder from Custom Action in Visual Studio Setup project Visual Studio安装程序项目:“自定义操作”->找不到入口点 - Visual Studio Installer Project: Custom Action -> entry point not found Windows Installer Visual Studio安装项目 - Windows Installer Visual Studio Setup Project Visual Studio 安装项目 - 生成的安装程序有问题 - Visual studio setup project - problem with the generated installer 将 SQLLocalDB 包含到 Visual Studio 安装程序安装项目中 - Include SQLLocalDB into Visual Studio Installer Setup Project 在Visual Studio 2017安装项目中为卸载添加自定义操作 - Add a custom action on uninstall in Visual Studio 2017 setup project 什么是Visual Studio 2010安装项目中的“运行时实现来自ASSEMBLE NAME”? (vs 2015中的安装程序扩展设置项目) - what is “Runtime Implementation from ASSEMBLE NAME” in visual studio 2010 Setup Project? (Installer Extension Setup Project in vs 2015) 从Visual Studio安装程序的安装安装程序中取消安装程序 - Cancelling Installer from Installing setup in Visual Studio Setup Visual Studio 安装项目:在没有管理员权限的情况下运行 msi 安装程序 - Visual Studio Setup Project: Run the msi installer without administrator rights ConfuserEx 使用 Visual Studio 安装程序安装项目,混淆无法正常工作? - ConfuserEx With Visual Studio Installer Setup Project, Obfuscation not working properly?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM