Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/create-release-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ runs:
env:
VERSION: ${{ inputs.version }}
run: |
dotnet tool install --global wix --version 6.0.2
dotnet tool install --global wix --version 7.0.1
for arch in ${{ inputs.archs }}; do
wix build Product.wxs -arch $arch -d MainExeSource="publish/$arch/Network Monitor.exe" -o "publish/Network-Monitor-$VERSION-$arch.msi"
wix build Product.wxs -arch $arch -acceptEula wix7 -o "publish/Network-Monitor-$VERSION-$arch.msi"
done

# The portable exes keep their names from one release to the next, so saving a new one over the old one keeps its settings and startup entry.
Expand Down
76 changes: 24 additions & 52 deletions Product.wxs
Original file line number Diff line number Diff line change
@@ -1,71 +1,43 @@
<?define Name = "Network Monitor"?>
<?define Manufacturer = "Daniel Chalmers"?>
<?define Guid = "46A5208D-49CB-499A-BC21-7B6993B1F3F4"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="Network Monitor" Manufacturer="Daniel Chalmers" Version="!(bind.FileVersion.NetworkMonitor.exe)" UpgradeCode="46A5208D-49CB-499A-BC21-7B6993B1F3F4" Scope="perUser">

<Package Name="$(var.Name)" Manufacturer="$(var.Manufacturer)" Version="!(bind.FileVersion.MainExe)" UpgradeCode="$(var.Guid)" Language="1033" InstallerVersion="500" Scope="perUser">
<Icon Id="NetworkMonitor.ico" SourceFile="Network Monitor\Network Monitor.ico" />

<SummaryInformation Manufacturer="$(var.Manufacturer)" />

<Icon Id="Logo.ico" SourceFile="$(var.Name)\$(var.Name).ico" />

<Property Id="ARPPRODUCTICON" Value="Logo.ico" />
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" />
<Property Id="ARPNOMODIFY" Value="yes" Secure="yes" />
<Property Id="ARPPRODUCTICON" Value="NetworkMonitor.ico" />
<Property Id="ARPURLINFOABOUT" Value="https://github.com/danielchalmers/Network-Monitor" />
<Property Id="ARPHELPLINK" Value="https://github.com/danielchalmers/Network-Monitor/issues" />
<Property Id="ARPNOREPAIR" Value="1" />
<Property Id="ARPNOMODIFY" Value="1" />

<!--Skips the System Restore point, which can hold a double-click install at "Please wait" for most of a minute and protects nothing in a per-user app folder-->
<Property Id="MSIFASTINSTALL" Value="1" />

<Media Id="1" Cabinet="App.cab" EmbedCab="yes" />
<!--The default schedule removes the old version before installing the new one, which a per-user upgrade needs to roll back cleanly-->
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="!(loc.WixDowngradePreventedMessage)" />

<Feature Id="ProductFeature" Title="$(var.Name)" Level="1">
<!--Main executable-->
<ComponentGroupRef Id="ProductComponents" />
<!--Program Menu shortcut-->
<ComponentRef Id="ApplicationShortcut" />
</Feature>
<MediaTemplate EmbedCab="yes" />

<!--Not WiX's default INSTALLFOLDER under Programs: the settings are stored under a hash of the exe's path, so moving the app would lose them-->
<StandardDirectory Id="LocalAppDataFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
<Directory Id="INSTALLFOLDER" Name="Network Monitor" />
</StandardDirectory>

<File Id="NetworkMonitor.exe" Source="publish\$(sys.BUILDARCH)\Network Monitor.exe" />

<StandardDirectory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.Name)" />
<Component>
<Shortcut Name="Network Monitor" Target="[INSTALLFOLDER]Network Monitor.exe" WorkingDirectory="INSTALLFOLDER" />
<RegistryValue Root="HKCU" Key="Software\Daniel Chalmers\Network Monitor" Name="StartMenuShortcut" Type="integer" Value="1" KeyPath="yes" />
<RemoveFolder Directory="INSTALLFOLDER" On="uninstall" />
</Component>
</StandardDirectory>

<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="$(var.Guid)">
<UpgradeVersion Minimum="0.0.0.0" Maximum="255.0.0.0" Property="PREVIOUSVERSIONSINSTALLED" IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>

<CustomAction Id="RunMainExe" Directory="INSTALLFOLDER" ExeCommand="[INSTALLFOLDER]$(var.Name).exe" Execute="commit" Return="asyncNoWait" />
<!--Started through Explorer so the widget gets the user's environment instead of the Windows Installer service's-->
<CustomAction Id="LaunchApp" Directory="INSTALLFOLDER" ExeCommand="&quot;[WindowsFolder]explorer.exe&quot; &quot;[#NetworkMonitor.exe]&quot;" Return="asyncNoWait" />

<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
<!--Start the widget after installing or upgrading, but not when uninstalling or installing silently-->
<Custom Action="RunMainExe" Before="InstallFinalize" Condition="NOT REMOVE AND UILevel &gt; 2" />
<Custom Action="LaunchApp" After="InstallFinalize" Condition="NOT Installed AND UILevel &gt; 2" />
</InstallExecuteSequence>
</Package>

<!--Main executable-->
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!--Not the GUID 4.x used: the exe is now a 64-bit component, and Windows Installer requires a new GUID when one replaces a 32-bit component-->
<Component Id="MainExe" Guid="09213AA3-FD1D-4FF7-A598-3AF48F47A6C8">
<File Id="MainExe" Name="$(var.Name).exe" Source="$(var.MainExeSource)" />
</Component>
</ComponentGroup>
</Fragment>

<!--Program Menu shortcut-->
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut">
<Shortcut Id="ApplicationStartMenuShortcut" Name="$(var.Name)" Icon="Logo.ico" Target="[#MainExe]" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Microsoft\$(var.Manufacturer)\$(var.Name)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
</Wix>