commit a6799efb2bf5f7f0c07b610cbb6804bf4939c095
parent 172fcd6c471f377997e2aab24d54b09c29c18fd7
Author: dittus <dittus@pm.me>
Date: Tue, 27 Oct 2026 15:58:56 -0400
Add an MSI installer
Diffstat:
3 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -8,9 +8,16 @@ Finds newer drivers for the hardware in a Windows PC and installs them. It check
- Admin rights. The app asks for them at startup because installing drivers and creating restore points both need them.
- 7-Zip, only for AMD chipset drivers. Without it the chipset row says to install it, and everything else still works.
- The .NET 10 SDK to build. The published exe runs without .NET installed.
+- To build the installer: nothing extra. `dotnet build` fetches the WiX 7 SDK from NuGet. The project accepts the WiX 7 EULA in `installer/DriverUpdater.Installer.wixproj`. Its maintenance fee applies only above US$10,000 a year in revenue.
The app has no NuGet dependencies. WMI and Windows Update are COM objects called through `dynamic`.
+## Download
+
+The installer is the Download link on https://dittus.dev/git/driver-updater/. It installs to `C:\Program Files\Driver Updater` and adds a Start Menu shortcut. Remove it from Settings, Apps.
+
+The MSI isn't code signed, so Windows SmartScreen warns before it runs. Choose More info, then Run anyway.
+
## Build and run
From the repo folder in an elevated terminal:
@@ -36,6 +43,27 @@ It lands in `bin\Release\net10.0-windows\win-x64\publish\DriverUpdater.exe`.
From WSL, run the same commands with `dotnet.exe` so the Windows SDK does the build.
+## Build the installer
+
+The installer wraps the published exe, so publish first:
+
+```powershell
+dotnet publish -c Release
+dotnet build installer -c Release
+```
+
+The MSI lands in `installer\bin\Release\DriverUpdater.msi`. It takes its version from the exe, so `<Version>` in `DriverUpdater.csproj` is the only place to change it. Never change the `UpgradeCode` in `installer/Package.wxs`. A newer MSI uses it to find and replace the installed copy.
+
+Windows Installer can't write its database to the WSL share, so from WSL point the installer's build folders at a Windows path:
+
+```bash
+dotnet.exe build installer -c Release \
+ '-p:BaseIntermediateOutputPath=C:\Temp\DriverUpdater-msi\obj\' \
+ '-p:OutputPath=C:\Temp\DriverUpdater-msi\out\'
+```
+
+Without that, the build fails with `WIX0223: Failed to open database`.
+
## Where updates come from
| Source | Devices | Lookup | Installs |
@@ -116,3 +144,4 @@ Windows quietly skips a restore point if it made one in the last 24 hours. The a
| `RestorePoint.cs` | Creates the restore point through WMI |
| `DriverUpdate.cs` | One row in the list |
| `Com.cs`, `Web.cs` | COM object creation and the shared `HttpClient` |
+| `installer/` | The WiX project that builds the MSI around the published exe |
diff --git a/installer/DriverUpdater.Installer.wixproj b/installer/DriverUpdater.Installer.wixproj
@@ -0,0 +1,12 @@
+<Project Sdk="WixToolset.Sdk/7.0.1">
+
+ <PropertyGroup>
+ <OutputName>DriverUpdater</OutputName>
+ <InstallerPlatform>x64</InstallerPlatform>
+ <!-- The maintenance fee in the WiX 7 EULA applies above US$10,000 a year in revenue. Accepted for this project. -->
+ <AcceptEula>wix7</AcceptEula>
+ <!-- The self contained exe from `dotnet publish -c Release` in the folder above. -->
+ <DefineConstants>PublishDir=..\bin\Release\net10.0-windows\win-x64\publish\</DefineConstants>
+ </PropertyGroup>
+
+</Project>
diff --git a/installer/Package.wxs b/installer/Package.wxs
@@ -0,0 +1,31 @@
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
+ <!-- The version comes from the exe itself, so the csproj's <Version> is the only place to set it.
+ UpgradeCode must never change. It's how a newer MSI finds and replaces the installed one. -->
+ <Package Name="Driver Updater"
+ Manufacturer="dittus"
+ Version="!(bind.FileVersion.DriverUpdaterExe)"
+ UpgradeCode="763010EA-B01A-407A-B24A-A60B1FBA291D"
+ Scope="perMachine">
+
+ <MajorUpgrade DowngradeErrorMessage="A newer version of Driver Updater is already installed." />
+ <MediaTemplate EmbedCab="yes" />
+
+ <StandardDirectory Id="ProgramFiles64Folder">
+ <Directory Id="INSTALLFOLDER" Name="Driver Updater">
+ <Component>
+ <File Id="DriverUpdaterExe" Source="$(PublishDir)DriverUpdater.exe" KeyPath="yes" />
+ </Component>
+ </Directory>
+ </StandardDirectory>
+
+ <!-- Windows Installer counts the Start Menu as per user, so the shortcut needs its own component
+ with a per user registry value to mark it installed. -->
+ <StandardDirectory Id="ProgramMenuFolder">
+ <Component>
+ <Shortcut Name="Driver Updater" Target="[INSTALLFOLDER]DriverUpdater.exe" WorkingDirectory="INSTALLFOLDER" />
+ <RegistryValue Root="HKCU" Key="Software\Driver Updater" Name="StartMenuShortcut" Type="integer" Value="1" KeyPath="yes" />
+ </Component>
+ </StandardDirectory>
+
+ </Package>
+</Wix>