DisplayMagician/DisplayMagicianSetup/Product.wxs
2020-12-28 22:30:39 +13:00

166 lines
10 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)" 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="314" Compressed="yes" InstallPrivileges="elevated" 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="no" AllowSameVersionUpgrades="no" DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" />
<!-- Reference the global WIXNETFX4RELEASEINSTALLED property so that will automatically pull in the .Net 4.8 variables (WiX 3.14 and higher only supported) -->
<!--<PropertyRef Id="WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED"/>
<Condition Message="!(loc.DotNetFrameworkNeeded)">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED]]>
</Condition>-->
<!-- Load the -->
<PropertyRef Id="WIXNETFX4RELEASEINSTALLED"/>
<Condition Message="!(loc.DotNetFrameworkNeeded)">
<![CDATA[Installed OR (WIXNETFX4RELEASEINSTALLED >= "#528040")]]>
</Condition>
<!--
Startup conditions that checks if .Net Framework 4.8 is installed or if
we're running Windows 8.1 or higher as the OS.
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.AppNotSupported)">
<![CDATA[Installed OR (VersionNT64 >= 603)]]>
</Condition>
<!-- 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>
<!-- Add in some text styles to make the text white -->
<TextStyle Id="White_Normal" FaceName="Tahoma" Size="8" Red="255" Green="255" Blue="255" />
<TextStyle Id="White_Bigger" FaceName="Tahoma" Size="12" Red="255" Green="255" Blue="255" />
<TextStyle Id="White_Title" FaceName="Tahoma" Size="9" Bold="yes" Red="255" Green="255" Blue="255" />
<!-- 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="LicenseAgreementDialogOverwritten">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="WixUIBannerBmp" Value="Resources\WixUIBannerBmpDark.png" />
<WixVariable Id="WixUIDialogBmp" Value="Resources\WixUIDialogBmp.png" />
<!-- 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>
<Component Id="HKLMRegistryEntries" Guid="4AB42CB7-3E2A-465B-9BE2-DDDE7D34797B">
<RegistryValue Root="HKLM" Key="Software\DisplayMagician" Type="string" Name="InstallDir" Value="[APPLICATIONROOTDIRECTORY]" KeyPath="yes"/>
</Component>
<Component Id="HKCURegistryEntries" Guid="481CA633-0BC0-49CD-B673-51BE9560B00F">
<RegistryValue Root="HKCU" Key="Software\DisplayMagician" Type="string" Name="AppDataDir" Value="[LocalAppDataFolder]" KeyPath="yes"/>
</Component>
</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.ProductDescription)"
Target="[APPLICATIONROOTDIRECTORY]$(var.DisplayMagician.TargetFileName)"
WorkingDirectory="APPLICATIONROOTDIRECTORY"
Icon="DisplayMagicianIcon.ico">
<!--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="CleanUpApplicationShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\DisplayMagician" Name="DisplayMagicianInstalled" Type="integer" Value="1" KeyPath="yes"/>
</Component>
<Component Id="LogReporterShortcut" Guid="1C24F22F-8796-4CF0-9E84-7D06B6662239">
<Shortcut Id="LogReporterStartMenuShortcut"
Name="!(loc.LogReporterName)"
Description="!(loc.LogReporterDescription)"
Target="[APPLICATIONROOTDIRECTORY]$(var.DisplayMagicianLogReporter.TargetFileName)"
WorkingDirectory="APPLICATIONROOTDIRECTORY"
Icon="DisplayMagicianIcon.ico" />
<RemoveFolder Id="CleanUpLogReporterShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\DisplayMagician" Name="LogReporterInstalled" 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" />
<!-- Set the last page to show a Launch DisplayMagician checkbox -->
<!--<Property Id="WixShellExecTarget" Value="[APPLICATIONROOTDIRECTORY]$(var.DisplayMagician.TargetFileName)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch !(loc.ProductName)" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />-->
<!-- Preapre custom actions to register and unregisterthe ShellExtension DLL -->
<CustomAction Id="InstallShell" FileKey="ServerRegistrationManager.exe" ExeCommand='install "[APPLICATIONROOTDIRECTORY]\DisplayMagicianShellExtension.dll" -codebase' Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="UninstallShell" FileKey="ServerRegistrationManager.exe" ExeCommand='uninstall "[APPLICATIONROOTDIRECTORY]\DisplayMagicianShellExtension.dll"' Execute="deferred" Return="check" Impersonate="no" />
<!-- Plumb the registering and unregistering of the ShellExtension DLL into the instllation sequence -->
<InstallExecuteSequence>
<Custom Action="InstallShell" After="InstallFiles">NOT Installed</Custom>
<Custom Action="UninstallShell" Before="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
<!-- 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="LogReporterShortcut" />
<ComponentRef Id="HKLMRegistryEntries" />
<ComponentRef Id="HKCURegistryEntries" />
<!-- Add in the 3 ShellExtension files we need to make the COM registration work -->
<Component Guid="*" Directory="APPLICATIONROOTDIRECTORY">
<File Id="DisplayMagicianShellExtension.dll" KeyPath="yes" Source="$(var.DisplayMagicianShellExtension.TargetDir)\DisplayMagicianShellExtension.dll" />
</Component>
<Component Guid="*" Directory="APPLICATIONROOTDIRECTORY">
<File Id="ServerRegistrationManager.exe" Source="$(var.DisplayMagicianShellExtension.TargetDir)\ServerRegistrationManager.exe" KeyPath="yes" />
</Component>
<Component Guid="*" Directory="APPLICATIONROOTDIRECTORY">
<File Id="SharpShell.dll" Source="$(var.DisplayMagicianShellExtension.TargetDir)\SharpShell.dll" KeyPath="yes" />
</Component>
<!-- Add in the LogReporter files we need -->
<Component Guid="*" Directory="APPLICATIONROOTDIRECTORY">
<File Id="LogReporter.exe" KeyPath="yes" Source="$(var.DisplayMagicianLogReporter.TargetDir)\LogReporter.exe" />
</Component>
<Component Guid="*" Directory="APPLICATIONROOTDIRECTORY">
<File Id="LogReporter.exe.config" KeyPath="yes" Source="$(var.DisplayMagicianLogReporter.TargetDir)\LogReporter.exe.config" />
</Component>
</Feature>
</Product>
</Wix>