维克斯 - 从安装目录中安装后如何运行exe文件? [英] Wix - How to run exe files after installation from installed directory?

查看:182
本文介绍了维克斯 - 从安装目录中安装后如何运行exe文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用它正在使用WiX的安装程序。 (不知道这是否是相关的,但它是一个C#程序)

I'm using a program which is being installed using wix. (Don't know if it's relevant but it's a C# program)

我要运行它是由MSI文件安装一个exe文件,但安装的位置是未知的我,因为用户选择安装路径。

I want to run an exe file which was installed by the msi file, but the location of the installation is unknown to me since the user chooses the installation path.

我想问例如如何运行从用户选择的位置的EXE文件。

I wanted to ask for example of how to run an exe file from the location the user chooses.

尽管这不是问题的一部分,我也很高兴地看到运行从绝对位置的exe文件的一些例子,因为我对维克斯初学者和做这一切的第一次。

Even though it's not a part of the question, I would also be glad to see some example of running an exe file from an absolute location since I'm a beginner to wix and doing it all for the first time.

推荐答案

这可以用WIX扩展的帮助来实现。在粗体/斜体下面的文字将处理找到你的EXE的确切位置的情况下:)

This can be achieved with the help of the WIX Extensions. The bold/italic text below will handle the case of finding the exact location of your EXE :)

< STRONG>第1步:添加扩展库到您的项目

如果您是在命令行中使用WiX的,你需要将以下添加到您的蜡烛光命令行:

If you are using WiX on the command-line you need to add the following to your candle and light command lines:

-ext WixUIExtension -ext WixUtilExtension

如果您正在使用Visual Studio,你可以使用添加引用对话框添加扩展名:

If you are using Visual Studio you can add the extensions using the Add Reference dialog:

Right click on your project in Solution Explorer and select Add Reference...
Select the WixUIExtension.dll assembly from the list and click Add
Select the WixUtilExtension.dll assembly from the list and click Add
Close the Add Reference dialog

第2步:添加UI到您的安装

维克斯最小UI序列包括对话的一个基本集,包括可选的复选框成品对话框。要在项目中包含的顺序任意位置添加下面的代码片段的<内部;产品方式> 元素

The WiX Minimal UI sequence includes a basic set of dialogs that includes a finished dialog with optional checkbox. To include the sequence in your project add the following snippet anywhere inside the <Product> element.

<UI>
    <UIRef Id="WixUI_Minimal" />
</UI>

要安装程序的最后一个屏幕上显示的复选框包括<$ C内的任意位置下面的代码片段$ C><产品> 元素:

To display the checkbox on the last screen of the installer include the following snippet anywhere inside the <Product> element:

<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch My Application Name" />



WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT属性由是,当设置,显示该复选框,并使用标准的UI序列提供了。指定值复选框标签

The WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT property is provided by the standard UI sequence that, when set, displays the checkbox and uses the specified value as the checkbox label.

第3步:包含的自定义动作

自定义操作包括在使用元素的WiX的项目。运行的应用程序与WixShellExecTarget自定义操作来完成。告诉Windows安装程序有关的自定义操作,并设置其属性,包括在项目中<内的任意位置以下;产品> 元素:

Custom actions are included in a WiX project using the element. Running an application is accomplished with the WixShellExecTarget custom action. To tell Windows Installer about the custom action, and to set its properties, include the following in your project anywhere inside the <Product> element:

<Property Id="WixShellExecTarget" Value="[#myapplication.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />



Property元素设置WixShellExecTarget到安装应用程序的位置。 WixShellExecTarget是载体ID WixShellExec自定义操作要求将被设置为运行该文件的位置。 *

Value属性使用特殊字符#告诉维克斯查找
id为myapplication.exe该文件的完整路径安装。

The Value property uses the special # character to tell WiX to look up the full installed path of the file with the id myapplication.exe.

CustomAction元素包括在安装程序的操作。它被赋予一个唯一的ID,而BinaryKey和DllEntry性能指示自定义操作的组装和切入点。该模拟属性告诉Windows安装程序运行自定义操作的安装用户


The CustomAction element includes the action in the installer. It is given a unique Id, and the BinaryKey and DllEntry properties indicate the assembly and entry point for the custom action. The Impersonate property tells Windows Installer to run the custom action as the installing user.

第四步:触发自定义操作

只需包括自定义操作,如在步骤3中,是不足够以使其运行。当自定义动作要触发Windows安装程序也必须告知。这是通过使用<完成的;发布> 元素将其添加到动作时,用户点击UI对话的最后一页上完成按钮运行。发布元素应包括步骤2中的元素在里面,看起来像这样:

Simply including the custom action, as in Step 3, isn't sufficient to cause it to run. Windows Installer must also be told when the custom action should be triggered. This is done by using the <Publish> element to add it to the actions run when the user clicks the Finished button on the final page of the UI dialogs. The Publish element should be included inside the element from Step 2, and looks like this:

<Publish Dialog="ExitDialog"
    Control="Finish" 
    Event="DoAction" 
    Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>



的对话框属性指定的定制操作将被连接到的对话框中,在这种情况下,ExitDialog。控制属性指定对话框中的Finish按钮会触发自定义操作。事件属性指示单击该按钮时,自定义操作应该运行,而Value属性指定被列入第3步:自定义操作元素上的条件阻止操作运行,除非步骤2中的复选框被选中而应用程序实际上是安装(而不是被拆除或维修)。

The Dialog property specifies the dialog the Custom Action will be attached to, in this case the ExitDialog. The Control property specifies that the Finish button on the dialog triggers the custom action. The Event property indicates that a custom action should be run when the button is clicked, and the Value property specifies the custom action that was included in Step 3. The condition on the element prevents the action from running unless the checkbox from Step 2 was checked and the application was actually installed (as opposed to being removed or repaired).

检查此链接了解详情。 如何运行exe文件安装后。我在这里把它抄了别人寻找相同的答案的利益。

Check this link for details. How to run exe after install. I copied it here for the benefit of others looking for the same answer.

这篇关于维克斯 - 从安装目录中安装后如何运行exe文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆