Selaa lähdekoodia

Add installer

Daniel Chalmers 3 vuotta sitten
vanhempi
sitoutus
55fb5ee6ab
2 muutettua tiedostoa jossa 71 lisäystä ja 0 poistoa
  1. 5 0
      .github/workflows/deploy.yml
  2. 66 0
      Product.wxs

+ 5 - 0
.github/workflows/deploy.yml

@@ -16,6 +16,11 @@ jobs:
       - name: Build
         run: dotnet publish -o "publish" -c Release -r win-x64
 
+      - name: Create installer
+        run: |
+          dotnet tool install --global wix --version 4.0.0-preview.0
+          wix build Product.wxs -o "publish/Install.msi"
+
       - name: Create GitHub release
         uses: softprops/action-gh-release@v1
         with:

+ 66 - 0
Product.wxs

@@ -0,0 +1,66 @@
+<?define Name = "DesktopClock"?>
+<?define Manufacturer = "Daniel Chalmers"?>
+<?define Guid = "6BD5BA59-2419-4A0E-89F8-C6F8A4EA08F7"?>
+
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
+
+  <Package Name="$(var.Name)" Manufacturer="$(var.Manufacturer)" Version="!(bind.FileVersion.MainExe)" UpgradeCode="$(var.Guid)" Language="1033" InstallerVersion="500" Scope="perUser">
+
+    <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" />
+
+    <Media Id="1" Cabinet="App.cab" EmbedCab="yes" />
+
+    <Feature Id="ProductFeature" Title="$(var.Name)" Level="1">
+      <!--Main executable-->
+      <ComponentGroupRef Id="ProductComponents" />
+      <!--Program Menu shortcut-->
+      <ComponentRef Id="ApplicationShortcut" />
+    </Feature>
+
+    <StandardDirectory Id="LocalAppDataFolder">
+      <Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
+    </StandardDirectory>
+
+    <StandardDirectory Id="ProgramMenuFolder">
+      <Directory Id="ApplicationProgramsFolder" Name="$(var.Name)" />
+    </StandardDirectory>
+
+    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
+    <Upgrade Id="$(var.Guid)">
+      <UpgradeVersion Minimum="0.0.0.0" Maximum="999.0.0.0" Property="PREVIOUSVERSIONSINSTALLED" IncludeMinimum="yes" IncludeMaximum="no" />
+    </Upgrade>
+
+    <CustomAction Id="RunMainExe" Directory="INSTALLFOLDER" ExeCommand="[INSTALLFOLDER]$(var.Name).exe" Execute="commit" Return="asyncNoWait" />
+
+    <InstallExecuteSequence>
+      <RemoveExistingProducts Before="InstallInitialize" />
+      <Custom Action="RunMainExe" Before="InstallFinalize" />
+    </InstallExecuteSequence>
+  </Package>
+
+  <!--Main executable-->
+  <Fragment>
+    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
+      <Component Id="MainExe" Guid="2148738D-B1F4-48BD-8615-1617541C6BB3">
+        <File Id="MainExe" Name="$(var.Name).exe" Source="publish/$(var.Name).exe" />
+      </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>