除了WixUILicenseRtf之外,我还需要展示许可证吗?

时间:2018-03-25 18:36:52

标签: wix windows-installer

wxs文件的Product元素中,我添加了:

<WixVariable Id="WixUILicenseRtf" Value="C:\Users\pupeno\...\src\main\deploy\package\windows\License.rtf" />

我认为正在读取该文件,因为如果我放置一条不存在的路径,则不会生成msi文件。但是,在安装过程中没有显示任何内容。我还缺少什么?

我是从javafxpackager模板开始的,所以它看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<!-- Customizing the wix template due to: https://github.com/FibreFoX/javafx-gradle-plugin/issues/100 -->

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Product Id="PRODUCT_GUID" Name="APPLICATION_NAME"
             Language="1033" Version="APPLICATION_VERSION"
             Manufacturer="APPLICATION_VENDOR"
             UpgradeCode="PUT-GUID-HERE">
        <Package Description="APPLICATION_DESCRIPTION" Comments="None"
                 InstallerVersion="200" Compressed="yes"
                 InstallScope="INSTALL_SCOPE" Platform="PLATFORM"/>
        <Media Id="1" Cabinet="simple.cab" EmbedCab="yes"/>

        <!-- We use RemoveFolderEx to ensure application folder is fully
             removed on uninstall. Including files created outside of MSI
             after application had been installed (e.g. on AU or user state).

             Hovewer, RemoveFolderEx is only available in WiX 3.6,
             we will comment it out if we running older WiX.

             RemoveFolderEx requires that we "remember" the path for uninstall.
             Read the path value and set the APPLICATIONFOLDER property with the value.
        -->
        <Property Id="APPLICATIONFOLDER">
            <RegistrySearch Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME"
                            Root="REGISTRY_ROOT" Type="raw"
                            Id="APPLICATIONFOLDER_REGSEARCH" Name="Path"/>
        </Property>
        <DirectoryRef Id="APPLICATIONFOLDER">
            <Component Id="CleanupMainApplicationFolder" Guid="*" Win64="WIN64">
                <RegistryValue Root="REGISTRY_ROOT"
                               Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME"
                               Name="Path" Type="string" Value="[APPLICATIONFOLDER]"
                               KeyPath="yes"/>
                <RegistryValue Root="HKLM"
                               Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME"
                               Name="AutoConnectTo" Type="string" Value="[AUTO_CONNECT_TO]"/>
                <!-- We need to use APPLICATIONFOLDER variable here or RemoveFolderEx
                     will not remove on "install". But only if WiX 3.6 is used. -->
                WIX36_ONLY_START
                <util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER"/>
                WIX36_ONLY_END
            </Component>
        </DirectoryRef>
        <?include bundle.wxi ?>
        UI_BLOCK
        APP_CDS_BLOCK
        <Icon Id="DesktopIcon.exe" SourceFile="APPLICATION_ICON"/>
        <Icon Id="StartMenuIcon.exe" SourceFile="APPLICATION_ICON"/>
        SECONDARY_LAUNCHER_ICONS
        <MajorUpgrade Schedule="afterInstallInitialize"
                      DowngradeErrorMessage="A later version of app is already installed. Setup will now exit."/>
        <Icon Id="icon.ico" SourceFile="App.ico"/>
        <Property Id="ARPPRODUCTICON" Value="icon.ico"/>
        <Property Id="AUTO_CONNECT_TO">
            <RegistrySearch Id="AutoConnectTo"
                            Root="HKLM"
                            Key="SOFTWARE\APPLICATION_VENDOR\APPLICATION_NAME"
                            Name="AutoConnectTo" Type="raw"/>
        </Property>
        <WixVariable Id="WixUILicenseRtf" Value="C:\Users\pupeno\...\src\main\deploy\package\windows\License.rtf" />
    </Product>
</Wix>

以及我使用完整路径的原因是因为我不知道javafxpackager期望的是什么。我希望看到它先工作。

1 个答案:

答案 0 :(得分:1)

更新:下面添加了有关如何在Visual Studio外编译WiX源的新部分。离开Visual Studio部分以供参考。

Visual Studio

您是否在Visual Studio中?如果是这样,我尝试使用 GUI 制作一个如何使用最小化WiX安装程序的简单演示和一个许可协议前一阵子。也许看看你是否有意义:WiX installer msi not installing the Winform app created with Visual Studio 2017

  • 尝试顶部的分步列表
  • 根据您的先前知识,您也可以直接查看底部的WiX来源(内联评论)
  • 至关重要的是,您需要参考WixUIExtension.dll,其中找到了GUI集

如果您遵循这些步骤,您应该成功。如果您不在Visual Studio中,则需要在调用candle.exelight.exe时获取命令行。不是火箭科学,但它可能有点繁琐,因为我喜欢称之为。也许在某个适当的命令行中有一个简单的示例 - 我现在没有任何可用的。

更新:忘记提及除了WiX之外还需要为Visual Studio安装这些扩展程序:http://wixtoolset.org/releases/。以防你还没有。

命令行编译

要编译WiX源文件并在Visual Studio外部包含带有许可协议RTF文件的默认GUI,请使用上面的示例更新WiX源,以便链接默认GUI,然后尝试使用这些命令行进行编译和链接您的WiX来源:

<强> 编译

candle.exe product.wxs -ext WixUIExtension

<强> 链接

light.exe -out Test.msi product.wixobj -ext WixUIExtension

如果情况正常,您应该在WiX XML源文件旁边找到一个Test.msi文件,并运行它,您应该获得一个带有指定许可协议的默认GUI。

而且,虽然显而易见,但我只想提一下:您可以通过命令提示符运行不带参数的参数来获取candle.exelight.exe参数的完整列表。

并且很明显 :您必须使用上面链接答案中的过程来设置此GUI和许可协议文件。在此处重复链接:WiX installer msi not installing the Winform app created with Visual Studio 2017

将自己的许可协议添加到MSI的本质就是这个WiX XML模糊

<UIRef Id="WixUI_Mondo" />
<WixVariable Id="WixUILicenseRtf" Value="TestLicenseAgreement.rtf" />
  • UIRef元素只指定WixUI_Mondo默认对话框(在WixUIExtension.dll中找到)
  • WixVariable元素只是指定 RTF许可文件(添加路径,如果有的话)
  • 然后通过上面命令行中显示的WixUIExtension.dll链接器的-ext开关与light.exe链接。

有几个这样的默认对话框,但我发现Mondo是最有效的。 How can I add an optional UI to WiX toolset

类似的答案:Create a msi from .wxs file using command line