Skip to content

Commit

Permalink
Merge pull request #514 from jeffu231/VIX-3445
Browse files Browse the repository at this point in the history
VIX-3445 Update installer to support self healing capabilities of msi
  • Loading branch information
jeffu231 authored Aug 20, 2023
2 parents 01dfd29 + 4b7dd40 commit 4a4b890
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 34 deletions.
8 changes: 4 additions & 4 deletions src/Vixen.DeployBundle/Vixen.DeployBundle.wixproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="WixToolset.Sdk/4.0.0-rc.3">
<Project Sdk="WixToolset.Sdk/4.0.1">
<PropertyGroup>
<DefineConstants>Version=$(App_Version);ReleaseType=$(Environment)</DefineConstants>
<BaseOutputPath>$(SolutionDir)$(Configuration)\Setup\$(Environment)</BaseOutputPath>
Expand All @@ -24,9 +24,9 @@
<OutputName>Vixen-$(App_Version)-Setup-32bit</OutputName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.0-rc.3" />
<PackageReference Include="WixToolset.Netfx.wixext" Version="4.0.0-rc.3" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.0-rc.3" />
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.1" />
<PackageReference Include="WixToolset.Netfx.wixext" Version="4.0.1" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Vixen.Installer\Vixen.Installer.wixproj" />
Expand Down
40 changes: 40 additions & 0 deletions src/Vixen.Installer/ExcludeVixenExeFile.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://wixtoolset.org/schemas/v4/wxs"
xmlns="http://schemas.microsoft.com/wix/2006/wi"

version="1.0"
exclude-result-prefixes="xsl wix">

<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />

<xsl:strip-space elements="*" />

<!--
Find all <Component> elements with <File> elements with Source="" attributes ending in ".exe" and tag it with the "ExeToRemove" key.
<Component Id="cmpSYYKP6B1M7WSD5KLEQ7PZW4YLOPYG61L" Directory="INSTALLDIR" Guid="*">
<File Id="filKUS7ZRMJ0AOKDU6ATYY6IRUSR2ECPDFO" KeyPath="yes" Source="!(wix.StagingAreaPath)\ProofOfPEqualsNP.exe" />
</Component>
Because WiX's Heat.exe only supports XSLT 1.0 and not XSLT 2.0 we cannot use `ends-with( haystack, needle )` (e.g. `ends-with( wix:File/@Source, '.exe' )`...
...but we can use this longer `substring` expression instead (see https://github.com/wixtoolset/issues/issues/5609 )
-->
<xsl:key
name="ExeToRemove"
match="wix:Component[wix:File[contains(@Source, 'Vixen.Application.exe')]]"
use="@Id"
/> <!-- Get the last 4 characters of a string using `substring( s, len(s) - 3 )`, it uses -3 and not -4 because XSLT uses 1-based indexes, not 0-based indexes. -->

<!-- By default, copy all elements and nodes into the output... -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>

<!-- ...but if the element has the "ExeToRemove" key then don't render anything (i.e. removing it from the output) -->
<xsl:template match="*[ self::wix:Component or self::wix:ComponentRef ][ key( 'ExeToRemove', @Id ) ]" />

</xsl:stylesheet>
5 changes: 3 additions & 2 deletions src/Vixen.Installer/Vixen.Installer.wixproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="WixToolset.Sdk/4.0.0-rc.3">
<Project Sdk="WixToolset.Sdk/4.0.1">
<PropertyGroup>
<DefineConstants>Version=$(App_Version);ReleaseType=$(Environment)</DefineConstants>
<BaseOutputPath>$(SolutionDir)$(Configuration)\Setup\$(Environment)</BaseOutputPath>
Expand Down Expand Up @@ -34,13 +34,14 @@
<SuppressRegistry>true</SuppressRegistry>
<SuppressCom>true</SuppressCom>
<SuppressRootDirectory>true</SuppressRootDirectory>
<Transforms>ExcludeVixenExeFile.xslt</Transforms>
</HarvestDirectory>
<BindPath Include="$(SolutionDir)$(Configuration)\Output" />
</ItemGroup>
<ItemGroup>
<Content Include="EnvironmentInclude.wxi" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Heat" Version="4.0.0-rc.3" />
<PackageReference Include="WixToolset.Heat" Version="4.0.1" />
</ItemGroup>
</Project>
69 changes: 42 additions & 27 deletions src/Vixen.Installer/VixenFolders.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,48 @@
<Directory Id="ApplicationProgramsFolder" Name="Vixen Lights"/>
</StandardDirectory>

<Icon Id="VixenIcon" SourceFile="..\..\Installer\vixen.ico" />

<Component Id="DesktopApplicationShortcut" Guid="$(var.DesktopGuid)" Directory="DesktopFolder" Condition="ADDDESKTOPSHORTCUT=1">
<Shortcut Id="DesktopShortcut"
Directory="DesktopFolder"
Name="!(bind.Property.ProductName)"
Description="Vixen Sequencer"
Target="[INSTALLFOLDER]Vixen.Application.exe"
WorkingDirectory="INSTALLFOLDER"
Icon="VixenIcon">
</Shortcut>
<Icon Id="VixenIcon.exe" SourceFile="..\..\Installer\vixen.ico" />
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="DesktopApplicationShortcut" Guid="$(var.DesktopGuid)" Condition="ADDDESKTOPSHORTCUT=1">
<File Id="VixenExe" Source="SourceDir\Vixen.Application.exe" KeyPath="yes">
<!-- Condition="ADDDESKTOPSHORTCUT=1" -->
<Shortcut Id="DesktopShortcut"
Directory="DesktopFolder"
Name="!(bind.Property.ProductName)"
Description="Vixen Sequencer"

WorkingDirectory="INSTALLFOLDER"
Icon="VixenIcon.exe" Advertise="yes">
</Shortcut>
<Shortcut Id="ApplicationStartMenuShortcut"
Directory="ApplicationProgramsFolder"
Name="!(bind.Property.ProductName)"
Description="Vixen Sequencer"

WorkingDirectory="INSTALLFOLDER"
Icon="VixenIcon.exe" Advertise="yes">
</Shortcut>
</File>
<RemoveFolder Id="CleanUpDirectory" Directory="ApplicationProgramsFolder" On="uninstall"/>

</Component>
<Component Id="ApplicationShortcut" Guid="$(var.MenuGuid)" Condition="ADDDESKTOPSHORTCUT=0">
<File Id="ApplicationShortcut_VixenExe" Source="SourceDir\Vixen.Application.exe" KeyPath="yes">
<Shortcut Id="ApplicationShortcut_ApplicationStartMenuShortcut"
Directory="ApplicationProgramsFolder"
Name="!(bind.Property.ProductName)"
Description="Vixen Sequencer"

WorkingDirectory="INSTALLFOLDER"
Icon="VixenIcon.exe" Advertise="yes">
</Shortcut>
</File>
<RemoveFolder Id="ApplicationShortcut_CleanUpDirectory" Directory="ApplicationProgramsFolder" On="uninstall"/>

</Component>
<Component Id="RegistryInstallValue" Guid="*">
<RegistryValue Root="HKCU" Key="Software\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>

<Component Id="ApplicationShortcut" Guid="$(var.MenuGuid)" Directory="ApplicationProgramsFolder">
<Shortcut Id="ApplicationStartMenuShortcut"
Directory="ApplicationProgramsFolder"
Name="!(bind.Property.ProductName)"
Description="Vixen Sequencer"
Target="[INSTALLFOLDER]Vixen.Application.exe"
WorkingDirectory="INSTALLFOLDER"
Icon="VixenIcon">
</Shortcut>

<RemoveFolder Id="CleanUpDirectory" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>

</Component>
</DirectoryRef>
</Fragment>
</Wix>
3 changes: 2 additions & 1 deletion src/Vixen.Installer/VixenReleasePackage.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

<Feature Id="Release">
<ComponentGroupRef Id="HarvestedComponents" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="RegistryInstallValue" />
<ComponentRef Id="DesktopApplicationShortcut"/>
<ComponentRef Id="ApplicationShortcut"/>
</Feature>
</Package>

Expand Down

0 comments on commit 4a4b890

Please sign in to comment.