Create desktop shortcut, detect various error conditions to fail installation, and only install VCRedist if it's not already present

This commit is contained in:
Cameron Gutman 2018-07-27 00:13:02 -07:00
parent 717c3903d1
commit b5965d763c
3 changed files with 68 additions and 19 deletions

View File

@ -1,10 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?define ShortName = "Moonlight" ?>
<?define FullName = "Moonlight Game Streaming Client" ?>
<?define ShortcutName = "$(var.ShortName)" ?>
<?define ShortcutDesc = "Stream games from a NVIDIA GameStream-compatible PC" ?>
<?define InstallFolder = "Moonlight Game Streaming" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension">
<Product Id="*"
Name="Moonlight Game Streaming"
Name="$(var.FullName)"
Language="1033"
Version="!(bind.fileVersion.MoonlightExe)"
Manufacturer="Moonlight Game Streaming Team"
@ -22,11 +29,12 @@
<?endif ?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="DesktopFolder" />
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLFOLDER" Name="Moonlight Game Streaming" />
<Directory Id="INSTALLFOLDER" Name="$(var.InstallFolder)" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Moonlight Game Streaming" />
<Directory Id="ApplicationProgramsFolder" Name="$(var.InstallFolder)" />
</Directory>
</Directory>
@ -42,31 +50,37 @@
<Custom Action="DeleteRegistryKey" Before="InstallFinalize">Installed AND REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="MoonlightShortcut" Guid="*">
<Shortcut Id="MoonlightStartMenuShortcut"
Name="Moonlight"
Description="Stream games from a NVIDIA GameStream-compatible PC"
<Component Id="MoonlightShortcuts" Guid="*" Directory="INSTALLFOLDER">
<Shortcut Id="StartMenuShortcut"
Name="$(var.ShortcutName)"
Description="$(var.ShortcutDesc)"
Target="[#MoonlightExe]"
WorkingDirectory="APPLICATIONROOTDIRECTORY" />
<RemoveFolder Id="CleanupMoonlightShortcut" Directory="ApplicationProgramsFolder" On="uninstall" />
Directory="ApplicationProgramsFolder"
WorkingDirectory="INSTALLFOLDER" />
<Shortcut Id="DesktopShortcut"
Name="$(var.ShortcutName)"
Description="$(var.ShortcutDesc)"
Target="[#MoonlightExe]"
Directory="DesktopFolder"
WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="CleanupStartMenuShortcut" Directory="ApplicationProgramsFolder" On="uninstall" />
<RemoveFolder Id="CleanupDesktopShortcut" Directory="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Moonlight Game Streaming Project" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="Moonlight" Guid="*">
<File Id="MoonlightExe" KeyPath="yes" Checksum="yes" Source="$(var.SourceDir)\Moonlight.exe">
<fire:FirewallException Id="MoonlightFirewallException"
Scope="any"
Name="Moonlight Game Streaming Client" />
Name="$(var.FullName)" />
</File>
</Component>
</DirectoryRef>
<Feature Id="ProductFeature" Title="Moonlight" Level="1" ConfigurableDirectory="INSTALLFOLDER">
<ComponentRef Id="Moonlight" />
<ComponentRef Id="MoonlightShortcut" />
<ComponentRef Id="MoonlightShortcuts" />
<ComponentGroupRef Id="MoonlightDependencies" />
</Feature>
</Product>

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="Moonlight Game Streaming Client"
Version="!(bind.PackageVersion.Moonlight)"
@ -12,7 +13,36 @@
DisableModify="yes"
IconSourceFile="..\..\app\moonlight.ico">
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]Moonlight Game Streaming\" />
<bal:Condition Message="Moonlight requires Windows 7 or later.">
<![CDATA[VersionNT >= v6.1]]>
</bal:Condition>
<!-- https://stackoverflow.com/questions/46637094/how-can-i-find-the-upgrade-code-for-an-installed-msi-file -->
<?if $(env.ARCH) ~= x86 ?>
<util:ProductSearch Id="Find_VCRedist_x86"
UpgradeCode="{C78B8E51-0C65-377E-85D1-282F689FE505}"
Result="state"
Variable="VCRedist_Present" />
<?elseif $(env.ARCH) ~= x64 ?>
<util:ProductSearch Id="Find_VCRedist_x64"
UpgradeCode="{9B0BAA88-E15F-3A1F-ACC0-B206E9DDF71C}"
Result="state"
Variable="VCRedist_Present" />
<?else ?>
<?error Bad ARCH value ?>
<?endif ?>
<?if $(env.ARCH) ~= x64 ?>
<bal:Condition Message="This Moonlight installer requires a 64-bit OS.">
VersionNT64
</bal:Condition>
<?endif ?>
<?if $(env.ARCH) ~= x64 ?>
<Variable Name="InstallFolder" Type="string" Value="[ProgramFiles64Folder]Moonlight Game Streaming" />
<?elseif $(env.ARCH) ~= x86 ?>
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]Moonlight Game Streaming" />
<?endif ?>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
@ -20,13 +50,14 @@
LicenseFile="license.rtf"
LogoFile="..\..\app\moonlight_wix.png"
ShowFilesInUse="yes"
LaunchTarget="[InstallFolder]Moonlight.exe" />
LaunchTarget="[InstallFolder]\Moonlight.exe" />
</BootstrapperApplicationRef>
<Chain>
<ExePackage Cache="no"
PerMachine="yes"
Permanent="yes"
InstallCondition="VCRedist_Present = 2"
Vital="yes"
Compressed="yes"
SourceFile="$(env.VCREDIST_INSTALLER)"

View File

@ -22,6 +22,10 @@
<HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath>
<Name>WixBalExtension</Name>
</WixExtension>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonlight\Moonlight.wixproj">