DisplayMagician/DisplayMagicianSetup/Product.wxs
Terry MacDonald f5e9ab4fc9 [WIP] Working WiX installer and Toasts!
This WiX installer installs a shortcut and registers
the AUMID and the ToastCLSID. Toasts now work!
2020-12-20 21:33:18 +13:00

120 lines
7.1 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--Code from https://weblogs.sqlteam.com/mladenp/2010/02/11/wix-3-tutorial-solutionproject-structure-and-dev-resources/ -->
<!-- Add xmlns:util namespace definition to be able to use stuff from WixUtilExtension dll-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!-- This is how we include wxi files -->
<?include $(sys.CURRENTDIR)Includes\DisplayMagicianVariables.wxi ?>
<!--
Id="*" is to enable upgrading. * means that the product ID will be autogenerated on each build.
Name is made of localized product name and version number.
-->
<Product Id="*" Name="!(loc.ProductName) $(var.VersionNumber)" Language="!(loc.LANG)" Version="$(var.VersionNumber)" Manufacturer="!(loc.ManufacturerName)" UpgradeCode="$(var.UpgradeCode)">
<!-- Define the minimum supported installer version (3.0) and that the install should be done for the whole machine not just the current user -->
<Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<!-- Upgrade settings. This will be explained in more detail in a future post -->
<!-- <Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion OnlyDetect="yes" Minimum="$(var.VersionNumber)" IncludeMinimum="no" Property="NEWER_VERSION_FOUND" />
<UpgradeVersion Minimum="0.0.0.0" IncludeMinimum="yes" Maximum="$(var.VersionNumber)" IncludeMaximum="no" Property="OLDER_VERSION_FOUND" />
</Upgrade> -->
<MajorUpgrade AllowDowngrades="yes" />
<!-- Reference the global NETFRAMEWORK462 property to check if it exists -->
<!-- <PropertyRef Id="NETFRAMEWORK462"/> -->
<!--
Startup conditions that checks if .Net Framework 4.6.2 is installed or if
we're running the OS higher than Windows 8.1.
If not the installation is aborted.
By doing the (Installed OR ...) property means that this condition will only
be evaluated if the app is being installed and not on uninstall or changing
-->
<!-- <Condition Message="!(loc.DotNetFrameworkNeeded)">
<![CDATA[Installed OR NETFRAMEWORK462]]>
</Condition>
<Condition Message="!(loc.AppNotSupported)">
<![CDATA[Installed OR (VersionNT >= 603))]]>
</Condition>-->
<!--
This custom action in the InstallExecuteSequence is needed to
stop silent install (passing /qb to msiexec) from going around it.
-->
<!-- <CustomAction Id="NewerVersionFound" Error="!(loc.DisplayMagicianNewerVersionInstalled)" />
<InstallExecuteSequence> -->
<!-- Check for newer versions with FindRelatedProducts and execute the custom action after it -->
<!-- <Custom Action="NewerVersionFound" After="FindRelatedProducts">
<![CDATA[NEWER_VERSION_FOUND]]>
</Custom> -->
<!-- Remove the previous versions of the product -->
<!-- <RemoveExistingProducts After="InstallInitialize"/> -->
<!-- WixCloseApplications is a built in custom action that uses util:CloseApplication below -->
<!-- <Custom Action="WixCloseApplications" Before="InstallInitialize" />
</InstallExecuteSequence> -->
<!-- This will ask the user to close the DisplayMagician app if it's running while upgrading -->
<util:CloseApplication Id="CloseDisplayMagician" CloseMessage="no" Description="!(loc.MustCloseDisplayMagician)"
ElevatedCloseMessage="no" RebootPrompt="no" Target="$(var.ExeProcessName)" />
<!-- Use the built in WixUI_InstallDir GUI -->
<UIRef Id="WixUI_InstallDir" />
<UI>
<!-- These dialog references are needed for CloseApplication above to work correctly -->
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<!-- Here we'll add the GUI logic for installation and updating in a future post-->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDialogOverwritten">1</Publish>
<Publish Dialog="LicenseAgreementDialogOverwritten" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementDialogOverwritten" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAcceptedOverwritten = "1" AND NOT OLDER_VERSION_FOUND</Publish>
<!-- <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="ProductKeyCheckDialog">1</Publish> -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<!-- Set the icon to show next to the program name in Add/Remove programs -->
<Icon Id="DisplayMagicianIcon.ico" SourceFile="$(var.ResourcesDir)\DisplayMagician.ico" />
<Property Id="ARPPRODUCTICON" Value="DisplayMagicianIcon.ico" />
<!-- Installer UI custom pictures. File names are made up. Add path to your pics
<WixVariable Id="WixUIDialogBmp" Value="MyAppLogo.jpg" /> <WixVariable Id="WixUIBannerBmp" Value="installBanner.jpg" /> -->
<!-- the default directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Create a 64-bit Programs Folder for the Application-->
<Directory Id="ProgramFiles64Folder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="!(loc.ProductName)" />
</Directory>
<!-- Create a Start Menu Folder for the Application-->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="!(loc.ProductName)"/>
</Directory>
</Directory>
<!-- Now we create an Application shortcut -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="6C7BFB9E-8549-4E34-BE44-E1A718146755">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="!(loc.ProductName)"
Description="!(loc.Description)"
Target="[APPLICATIONROOTDIRECTORY]$(var.DisplayMagician.TargetFileName)"
WorkingDirectory="APPLICATIONROOTDIRECTORY">
<!--AUMID-->
<ShortcutProperty Key="System.AppUserModel.ID" Value="LittleBitBig.DisplayMagician"/>
<!--COM CLSID-->
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{56F14154-6339-4B94-8B82-80F78D5BCEAF}"/>
</Shortcut>
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\DisplayMagician" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Set the default install location to the value of APPLICATIONROOTDIRECTORY (usually c:\Program Files\YourProductName) -->
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONROOTDIRECTORY" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch !(loc.ProductName)" />
<Property Id="WixShellExecTarget" Value="[APPLICATIONROOTDIRECTORY]$(var.DisplayMagician.TargetFileName)" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<!-- Set the components defined in our fragment files that will be used for our feature -->
<Feature Id="DisplayMagicianFeature" Title="!(loc.ProductName)" Level="1">
<ComponentGroupRef Id="DisplayMagicianFiles" />
<ComponentRef Id="ApplicationShortcut" />
<!-- <ComponentRef Id="cmpVersionInRegistry" /> -->
<!-- <ComponentRef Id="cmpIsThisUpdateInRegistry" /> -->
</Feature>
</Product>
</Wix>