PMP.wxs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. <RemoveExistingProducts After="InstallInitialize">PREVIOUSVERSIONINSTALLED</RemoveExistingProducts>
  58. <Custom Action="LaunchPMP" After="InstallFinalize"><![CDATA[AUTOLAUNCH = 1]]></Custom>
  59. <Custom Action="WixCloseApplications" After="InstallInitialize" />
  60. <Custom Action="EnableMediaFoundation" Before="CostFinalize">WINDOWSTYPE~="Server"</Custom>
  61. </InstallExecuteSequence>
  62. <!-- Custom Actions -->
  63. <CustomAction Id="PreventDowngrades" Error="$(var.NewerVersionError)" />
  64. <!-- The default installation directory is under [ProgramFilesFolder] -->
  65. <Directory Id="TARGETDIR" Name="SourceDir">
  66. <Directory Id="ProgramFiles64Folder">
  67. <Directory Id="INSTALLLOCATION" Name="Msi">
  68. </Directory>
  69. </Directory>
  70. <Directory Id="ProgramMenuFolder">
  71. <Directory Id="PlexStartMenuFolder" Name="Plex Media Player"/>
  72. </Directory>
  73. </Directory>
  74. <!-- Start Menu shortcut -->
  75. <DirectoryRef Id="PlexStartMenuFolder">
  76. <Component Id="PlexMediaPlayerShortcuts" Guid="*">
  77. <Shortcut Id="PlexMediaPlayerExeShortcut"
  78. Name="Plex Media Player"
  79. Description="Plex Media Player for Windows"
  80. Target="[INSTALLLOCATION]PlexMediaPlayer.exe"
  81. WorkingDirectory="INSTALLLOCATION" />
  82. <RegistryKey Root="HKCU" Key="Software\Plex, Inc.\Plex Media Player">
  83. <RegistryValue Name="InstallFolder" Type="string" Value="[INSTALLLOCATION]" Action="write" KeyPath="no" />
  84. </RegistryKey>
  85. <!-- Firewall Exceptions -->
  86. <!-- These should probably go in their own component, but it's easier just to put them here -->
  87. <fire:FirewallException Id="FWX1" Name="Plex Media Player" Program="[INSTALLLOCATION]PlexMediaPlayer.exe" Scope="any" IgnoreFailure="yes" />
  88. <fire:FirewallException Id="FWX2" Name="Plex Media Player Helper" Program="[INSTALLLOCATION]PMPHelper.exe" Scope="any" IgnoreFailure="yes" />
  89. <RemoveFolder Id="PlexStartMenuFolder" On="uninstall" />
  90. </Component>
  91. </DirectoryRef>
  92. <!-- Product Feature -->
  93. <Feature Id="ProductFeature" Title="Plex" Level="1">
  94. <ComponentGroupRef Id="ProgramFilesComponentGroup" />
  95. <ComponentRef Id="PlexMediaPlayerShortcuts" />
  96. </Feature>
  97. </Product>
  98. </Wix>