Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
397 views
in Technique[技术] by (71.8m points)

wix - What else do I need to show the license aside from WixUILicenseRtf?

In my wxs file, in the Product element, I added:

<WixVariable Id="WixUILicenseRtf" Value="C:Userspupeno...srcmaindeploypackagewindowsLicense.rtf" />

I think the file is being read because if I put a path that doesn't exist, the msi file is not generate. But, nothing is shown during the installation process. What else am I missing?

I'm starting from the javafxpackager template, so, it looks something like this:

<?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="SOFTWAREAPPLICATION_VENDORAPPLICATION_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="SOFTWAREAPPLICATION_VENDORAPPLICATION_NAME"
                               Name="Path" Type="string" Value="[APPLICATIONFOLDER]"
                               KeyPath="yes"/>
                <RegistryValue Root="HKLM"
                               Key="SOFTWAREAPPLICATION_VENDORAPPLICATION_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="SOFTWAREAPPLICATION_VENDORAPPLICATION_NAME"
                            Name="AutoConnectTo" Type="raw"/>
        </Property>
        <WixVariable Id="WixUILicenseRtf" Value="C:Userspupeno...srcmaindeploypackagewindowsLicense.rtf" />
    </Product>
</Wix>

and the reason why I'm using a full path is because I don't know relative to what is javafxpackager expecting. I want to see it working first.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

UPDATE: New section added underneath on how to compile WiX sources outside Visual Studio. Leaving in Visual Studio section for reference.


Visual Studio

Are you in Visual Studio? If so, I tried to make a simple demo of how to do a minimal WiX installer with GUI and a license agreement a while back. Maybe see if it makes sense to you: WiX installer msi not installing the Winform app created with Visual Studio 2017.

  • Try the step-by-step list on top
  • With your prior knowledge you can also just look directly in the WiX source at the bottom (inline comments)
  • Crucially you need a reference to WixUIExtension.dll where the GUI sets are found

If you follow those steps you should succeed. If you are not in Visual Studio, then you need to get the command lines right when you call candle.exe and light.exe. Not rocket science, but it can be a bit fiddly as I like to call it. Maybe there is a simple sample somewhere of proper command lines - I don't have any available right now.


UPDATE: Forgot to mention that you need to install these extensions for Visual Studio in addition to WiX: http://wixtoolset.org/releases/. Just in case you haven't already.


Command Line Compile

To compile a WiX source file and include a default GUI with a license agreement RTF file outside Visual Studio, please use the sample above to update the WiX source so it links a default GUI, then try these command lines to compile and link your WiX sources:

Compile:

candle.exe product.wxs -ext WixUIExtension

Link:

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

If things work correctly you should get a Test.msi file next to your WiX XML source file, and running it you should get a default GUI with your specified license agreement.

And, though obvious, I will just mention it: you can get a full list of candle.exe and light.exe parameters by just running them without parameters via a command prompt.

And just so it is clear: you must use the procedure in the linked answer above to set up this GUI and the license agreement file. Repeating the link here: WiX installer msi not installing the Winform app created with Visual Studio 2017

The essence of adding your own license agreement to your MSI is just this WiX XML blurb:

<UIRef Id="WixUI_Mondo" />
<WixVariable Id="WixUILicenseRtf" Value="TestLicenseAgreement.rtf" />
  • The UIRef element just specifies the WixUI_Mondo default dialog set (found in WixUIExtension.dll)
  • The WixVariable element simply specifies an RTF license file (add path, if any)
  • Then you link with WixUIExtension.dll by the -ext switch for the light.exe linker as shown in the command line above.

There are several such default dialog sets, but I find that Mondo is the one that works best. How can I add an optional UI to WiX toolset.


Similar answer: Create a msi from .wxs file using command line


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...