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

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" <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" <Bundle Name="Moonlight Game Streaming Client"
Version="!(bind.PackageVersion.Moonlight)" Version="!(bind.PackageVersion.Moonlight)"
@ -12,7 +13,36 @@
DisableModify="yes" DisableModify="yes"
IconSourceFile="..\..\app\moonlight.ico"> 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"> <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication <bal:WixStandardBootstrapperApplication
@ -20,13 +50,14 @@
LicenseFile="license.rtf" LicenseFile="license.rtf"
LogoFile="..\..\app\moonlight_wix.png" LogoFile="..\..\app\moonlight_wix.png"
ShowFilesInUse="yes" ShowFilesInUse="yes"
LaunchTarget="[InstallFolder]Moonlight.exe" /> LaunchTarget="[InstallFolder]\Moonlight.exe" />
</BootstrapperApplicationRef> </BootstrapperApplicationRef>
<Chain> <Chain>
<ExePackage Cache="no" <ExePackage Cache="no"
PerMachine="yes" PerMachine="yes"
Permanent="yes" Permanent="yes"
InstallCondition="VCRedist_Present = 2"
Vital="yes" Vital="yes"
Compressed="yes" Compressed="yes"
SourceFile="$(env.VCREDIST_INSTALLER)" SourceFile="$(env.VCREDIST_INSTALLER)"

View File

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