PMP.wxs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
  3. xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
  4. xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension">
  5. <?include Global.wxi ?>
  6. <?include Version.wxi ?>
  7. <?define FirstProductVersion=1.0.0 ?>
  8. <?define PlexMediaPlayerRegistryKey=Software\Plex, Inc.\Plex Media Player?>
  9. <!-- To keep things simple, the installer considers each new release
  10. a major upgrade, in which everything is uninstalled, then reinstalled
  11. To accomplish this, we change the Product Id on every build.
  12. However, the upgrade code remains the same on every build, to ensure
  13. that newer installers recognize older installations -->
  14. <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="Plex" UpgradeCode="$(var.ProductUUID)">
  15. <!-- Package Ids change on every build, by definition -->
  16. <Package Id="*" Platform="x64" InstallerVersion="405" Compressed="yes" Description="$(var.ProductDesc)" InstallScope="perMachine" />
  17. <!-- allow for reinstall, this is needed to force installation when the version match -->
  18. <Property Id="REINSTALLMODE" Value="amus"/>
  19. <!-- Embedded, compressed cab file -->
  20. <Media Id="1" Cabinet="pmp.cab" EmbedCab="yes" CompressionLevel="high" />
  21. <!-- We support Windows 7 and above -->
  22. <Condition Message="$(var.OldWindowsError)">
  23. <![CDATA[VersionNT >= 601]]>
  24. </Condition>
  25. <!-- Icon used in the control panel -->
  26. <Icon Id="PlexMediaPlayerIcon" SourceFile="Plex.ico" />
  27. <!-- Useful control panel fields -->
  28. <?include ControlPanel.wxi ?>
  29. <!-- Upgrade and downgrade handling -->
  30. <Upgrade Id="$(var.ProductUUID)">
  31. <!-- Detect newer versions -->
  32. <UpgradeVersion Minimum="$(var.Version)"
  33. IncludeMinimum="no"
  34. OnlyDetect="yes"
  35. Property="NEWERPRODUCTFOUND" />
  36. <!-- Detect older versions -->
  37. <UpgradeVersion Minimum="$(var.FirstProductVersion)"
  38. Maximum="$(var.Version)"
  39. IncludeMinimum="yes"
  40. IncludeMaximum="no"
  41. Property="PREVIOUSVERSIONINSTALLED" />
  42. </Upgrade>
  43. <!-- Running program termination -->
  44. <util:CloseApplication Id="PlexMediaPlayer" CloseMessage="yes" Target="PlexMediaPlayer.exe" ElevatedCloseMessage="yes" RebootPrompt="yes" />
  45. <util:CloseApplication Id="PMPHelper" CloseMessage="yes" Target="PMPHelper.exe" ElevatedCloseMessage="yes" RebootPrompt="yes" />
  46. <!-- Custom action to Install MediaFoundation on Windows Server -->
  47. <Property Id="WINDOWSTYPE" Value="Client"/>
  48. <Property Id="WixQuietExec64CmdLine" Value='"C:\Windows\System32\dism.exe" /online /enable-feature /all /featurename:ServerMediaFoundation /NoRestart'/>
  49. <CustomAction Id="EnableMediaFoundation" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="immediate" Return="ignore" Impersonate="no"/>
  50. <Property Id="AUTOLAUNCH" Value="0"/>
  51. <Property Id="WixShellExecTarget" Value="[INSTALLLOCATION]PlexMediaPlayer.exe" />
  52. <CustomAction Id="LaunchPMP" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore"/>
  53. <InstallExecuteSequence>
  54. <!-- Prevent downgrades from newer versions -->
  55. <Custom Action="PreventDowngrades" After="FindRelatedProducts">NEWERPRODUCTFOUND</Custom>
  56. <!-- Uninstall older versions before installing ourselves -->
  57. <RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
  58. <RemoveExistingProducts After="InstallInitialize">PREVIOUSVERSIONINSTALLED</RemoveExistingProducts>
  59. <Custom Action="LaunchPMP" After="InstallFinalize"><![CDATA[AUTOLAUNCH = 1]]></Custom>
  60. <Custom Action="WixCloseApplications" After="InstallInitialize" />
  61. <Custom Action="EnableMediaFoundation" Before="CostFinalize">WINDOWSTYPE~="Server"</Custom>
  62. </InstallExecuteSequence>
  63. <!-- Custom Actions -->
  64. <CustomAction Id="PreventDowngrades" Error="$(var.NewerVersionError)" />
  65. <!-- The default installation directory is under [ProgramFilesFolder] -->
  66. <Directory Id="TARGETDIR" Name="SourceDir">
  67. <Directory Id="ProgramFiles64Folder">
  68. <Directory Id="INSTALLLOCATION" Name="Msi">
  69. </Directory>
  70. </Directory>
  71. <Directory Id="ProgramMenuFolder">
  72. <Directory Id="PlexStartMenuFolder" Name="Plex Media Player"/>
  73. </Directory>
  74. </Directory>
  75. <!-- Start Menu shortcut -->
  76. <DirectoryRef Id="PlexStartMenuFolder">
  77. <Component Id="PlexMediaPlayerShortcuts" Guid="*">
  78. <Shortcut Id="PlexMediaPlayerExeShortcut"
  79. Name="Plex Media Player"
  80. Description="Plex Media Player for Windows"
  81. Target="[INSTALLLOCATION]PlexMediaPlayer.exe"
  82. WorkingDirectory="INSTALLLOCATION" />
  83. <RegistryKey Root="HKCU" Key="Software\Plex, Inc.\Plex Media Player">
  84. <RegistryValue Name="InstallFolder" Type="string" Value="[INSTALLLOCATION]" Action="write" KeyPath="no" />
  85. </RegistryKey>
  86. <!-- Firewall Exceptions -->
  87. <!-- These should probably go in their own component, but it's easier just to put them here -->
  88. <fire:FirewallException Id="FWX1" Name="Plex Media Player" Program="[INSTALLLOCATION]PlexMediaPlayer.exe" Scope="any" IgnoreFailure="yes" />
  89. <fire:FirewallException Id="FWX2" Name="Plex Media Player Helper" Program="[INSTALLLOCATION]PMPHelper.exe" Scope="any" IgnoreFailure="yes" />
  90. <RemoveFolder Id="PlexStartMenuFolder" On="uninstall" />
  91. </Component>
  92. </DirectoryRef>
  93. <!-- Product Feature -->
  94. <Feature Id="ProductFeature" Title="Plex" Level="1">
  95. <ComponentGroupRef Id="ProgramFilesComponentGroup" />
  96. <ComponentRef Id="PlexMediaPlayerShortcuts" />
  97. </Feature>
  98. </Product>
  99. </Wix>