Moved building MSI to Installer and created Bootstrapper in Setup
This commit is contained in:
50
Installer/BuildFilesTransform.xslt
Normal file
50
Installer/BuildFilesTransform.xslt
Normal file
@ -0,0 +1,50 @@
|
||||
<?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://wixtoolset.org/schemas/v4/wxs"
|
||||
|
||||
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[ substring( wix:File/@Source, string-length( wix:File/@Source ) - 3 ) = '.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. -->
|
||||
|
||||
<!-- We can also remove .pdb files too, for example: -->
|
||||
<xsl:key
|
||||
name="PdbToRemove"
|
||||
match="wix:Component[ substring( wix:File/@Source, string-length( wix:File/@Source ) - 3 ) = '.pdb' ]"
|
||||
use="@Id"
|
||||
/>
|
||||
|
||||
<!-- 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:template match="*[ self::wix:Component or self::wix:ComponentRef ][ key( 'PdbToRemove', @Id ) ]" />
|
||||
|
||||
</xsl:stylesheet>
|
12
Installer/DocumentTemplateComponents.wxs
Normal file
12
Installer/DocumentTemplateComponents.wxs
Normal file
@ -0,0 +1,12 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<ComponentGroup Id="DocumentTemplateComponents" Directory="ConfigFolderResources">
|
||||
<Component>
|
||||
<File Source="$(TargetDir)\paged.polyfill.js" />
|
||||
</Component>
|
||||
<Component>
|
||||
<File Source="$(var.ElwigProjectDir)\Documents\style.css" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
41
Installer/DocumentTemplatesTransform.xslt
Normal file
41
Installer/DocumentTemplatesTransform.xslt
Normal file
@ -0,0 +1,41 @@
|
||||
<?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://wixtoolset.org/schemas/v4/wxs"
|
||||
|
||||
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="FileToRemove"
|
||||
match="wix:Component[ substring( wix:File/@Source, string-length( wix:File/@Source ) - 6 ) != '.cshtml' ]"
|
||||
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( 'FileToRemove', @Id ) ]" />
|
||||
|
||||
</xsl:stylesheet>
|
30
Installer/Files/config.ini
Normal file
30
Installer/Files/config.ini
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
[general]
|
||||
; Only needed, if more than one branch is stored in database
|
||||
branch = Zweigstelle
|
||||
|
||||
[database]
|
||||
; Relative or absolute path to database file
|
||||
file = database.sqlite3
|
||||
; Enables database logging
|
||||
;log = db.log
|
||||
|
||||
;[scale.1]
|
||||
;type = systec
|
||||
;model = IT3000A
|
||||
;connection = serial://COM1:9600,8,N,1
|
||||
;empty = COM2:RTS:1000
|
||||
;filling = DTR
|
||||
; Limit on when the filling clearance should be removed
|
||||
;limit = 3500
|
||||
; Enables scale logging
|
||||
;log = waage.log
|
||||
|
||||
;[scale.B]
|
||||
;type = Type
|
||||
;model = Model
|
||||
;connection = tcp://10.0.0.1:1234
|
||||
;empty = OUT1:3000
|
||||
;filling = OUT2
|
||||
; Limit on when the filling clearance should be removed
|
||||
;limit = 3000
|
23
Installer/Folders.wxs
Normal file
23
Installer/Folders.wxs
Normal file
@ -0,0 +1,23 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<!-- C:\Program Files (x86)\Elwig oder C:\Program Files\Elwig -->
|
||||
<StandardDirectory Id="ProgramFiles64Folder">
|
||||
<Directory Id="InstallFolder" Name="!(bind.Property.ProductName)" />
|
||||
</StandardDirectory>
|
||||
|
||||
<!-- C:\ProgramData\Elwig -->
|
||||
<StandardDirectory Id="CommonAppDataFolder">
|
||||
<Directory Id="ConfigFolder" Name="!(bind.Property.ProductName)">
|
||||
<Directory Id="ConfigFolderResources" Name="resources" />
|
||||
</Directory>
|
||||
</StandardDirectory>
|
||||
|
||||
<!-- C:\ProgramData\Microsoft\Windows\Start Menu\Programs -->
|
||||
<StandardDirectory Id="ProgramMenuFolder">
|
||||
<Directory Id="StartMenuProgramsFolder" Name="!(bind.Property.ProductName)" />
|
||||
</StandardDirectory>
|
||||
|
||||
<!-- C:\Users{USERNAME}\Desktop -->
|
||||
<StandardDirectory Id="DesktopFolder" />
|
||||
</Fragment>
|
||||
</Wix>
|
66
Installer/Installer.wixproj
Normal file
66
Installer/Installer.wixproj
Normal file
@ -0,0 +1,66 @@
|
||||
<Project Sdk="WixToolset.Sdk/4.0.1">
|
||||
<PropertyGroup>
|
||||
<HarvestFileSuppressUniqueIds>false</HarvestFileSuppressUniqueIds>
|
||||
<HarvestFileGenerateGuidsNow>true</HarvestFileGenerateGuidsNow>
|
||||
<HarvestDirectorySuppressRegistry>false</HarvestDirectorySuppressRegistry>
|
||||
<HarvestDirectoryVerboseOutput>true</HarvestDirectoryVerboseOutput>
|
||||
<HarvestProjectsDirectoryIds>InstallFolder</HarvestProjectsDirectoryIds>
|
||||
<CabinetCachePath>$(OutputPath)bin\cabcache\</CabinetCachePath>
|
||||
<ReuseCabinetCache>True</ReuseCabinetCache>
|
||||
<SuppressValidation>True</SuppressValidation>
|
||||
<BuildProjectReferences>False</BuildProjectReferences>
|
||||
<OutputName>Elwig</OutputName>
|
||||
<Cultures>de-AT</Cultures>
|
||||
</PropertyGroup>
|
||||
<UsingTask TaskName="GetFileVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
||||
<ParameterGroup>
|
||||
<AssemblyPath ParameterType="System.String" Required="true" />
|
||||
<Version ParameterType="System.String" Output="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Using Namespace="System.Diagnostics" />
|
||||
<Code Type="Fragment" Language="cs"><![CDATA[
|
||||
this.Version = FileVersionInfo.GetVersionInfo(this.AssemblyPath).ProductVersion;
|
||||
]]></Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
||||
<Exec Command="curl -s -L "https://unpkg.com/pagedjs/dist/paged.polyfill.js" -o "$(TargetDir)paged.polyfill.js"" />
|
||||
<Exec Command="curl -s "http://www.columbia.edu/~em36/PDFtoPrinter.exe" -z "$(TargetDir)PDFtoPrinter.exe" -o "$(TargetDir)PDFtoPrinter.exe"" />
|
||||
<Exec Command="dotnet publish "$(SolutionDir)Elwig\Elwig.csproj" "/p:PublishProfile=$(SolutionDir)\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"" />
|
||||
<GetFileVersion AssemblyPath="..\Elwig\bin\Publish\Elwig.exe">
|
||||
<Output TaskParameter="Version" PropertyName="ElwigFileVersion" />
|
||||
</GetFileVersion>
|
||||
<PropertyGroup>
|
||||
<DefineConstants>ProductVersion=$(ElwigFileVersion);BuildPath=..\Elwig\bin\Publish;DocumentTemplatesPath=..\Elwig\Documents;ElwigProjectDir=..\Elwig</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<HarvestDirectory Include="../Elwig/bin/Publish">
|
||||
<ComponentGroupName>BuildFiles</ComponentGroupName>
|
||||
<DirectoryRefId>InstallFolder</DirectoryRefId>
|
||||
<SuppressRootDirectory>true</SuppressRootDirectory>
|
||||
<PreprocessorVariable>BuildPath</PreprocessorVariable>
|
||||
<Transforms>BuildFilesTransform.xslt</Transforms>
|
||||
</HarvestDirectory>
|
||||
<BindPath BindName="BuildBindPath" Include="../Elwig/bin/Publish" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<HarvestDirectory Include="../Elwig/Documents">
|
||||
<ComponentGroupName>DocumentTemplates</ComponentGroupName>
|
||||
<DirectoryRefId>ConfigFolderResources</DirectoryRefId>
|
||||
<SuppressRootDirectory>true</SuppressRootDirectory>
|
||||
<PreprocessorVariable>DocumentTemplatesPath</PreprocessorVariable>
|
||||
<Transforms>DocumentTemplatesTransform.xslt</Transforms>
|
||||
</HarvestDirectory>
|
||||
<BindPath BindName="DocumentTemplateBindPath" Include="../Elwig/Documents" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="DocumentTemplatesTransform.xslt" />
|
||||
<None Include="BuildFilesTransform.xslt" />
|
||||
<None Include="Files\config.ini" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="WixToolset.Heat" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
15
Installer/MainComponents.wxs
Normal file
15
Installer/MainComponents.wxs
Normal file
@ -0,0 +1,15 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<ComponentGroup Id="MainComponents">
|
||||
<Component Directory="InstallFolder">
|
||||
<File Source="$(var.ElwigProjectDir)\bin\Publish\Elwig.exe" Id="Elwig.exe"/>
|
||||
</Component>
|
||||
<Component Directory="ConfigFolder" Permanent="true" NeverOverwrite="true">
|
||||
<File Source="$(ProjectDir)\Files\config.ini" Id="config.ini"/>
|
||||
</Component>
|
||||
<Component Directory="InstallFolder">
|
||||
<File Source="$(TargetDir)\PDFtoPrinter.exe" Id="PDFtoPrinter.exe"/>
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
8
Installer/Package.de-at.wxl
Normal file
8
Installer/Package.de-at.wxl
Normal file
@ -0,0 +1,8 @@
|
||||
<!--
|
||||
This file contains the declaration of all the localizable strings.
|
||||
-->
|
||||
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="de-AT">
|
||||
|
||||
<String Id="DowngradeError" Value="Eine neuere Version von [ProductName] ist bereits installiert." />
|
||||
|
||||
</WixLocalization>
|
17
Installer/Package.wxs
Normal file
17
Installer/Package.wxs
Normal file
@ -0,0 +1,17 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package Name="Elwig" Manufacturer="Elwig" Version="$(var.ProductVersion)" Language="3079" UpgradeCode="a459416a-756a-4be6-b6f4-40872c8425a7" Compressed="true">
|
||||
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" AllowSameVersionUpgrades="no" />
|
||||
<MediaTemplate EmbedCab="true" MaximumUncompressedMediaSize="10"/>
|
||||
|
||||
<Icon Id="icon.ico" SourceFile="$(var.ElwigProjectDir)\elwig.ico"/>
|
||||
<Property Id="ARPPRODUCTICON" Value="icon.ico"/>
|
||||
|
||||
<Feature Id="Main">
|
||||
<ComponentGroupRef Id="ShortcutComponents"/>
|
||||
<ComponentGroupRef Id="MainComponents"/>
|
||||
<ComponentGroupRef Id="BuildFiles"/>
|
||||
<ComponentGroupRef Id="DocumentTemplates"/>
|
||||
<ComponentGroupRef Id="DocumentTemplateComponents"/>
|
||||
</Feature>
|
||||
</Package>
|
||||
</Wix>
|
27
Installer/ShortcutComponents.wxs
Normal file
27
Installer/ShortcutComponents.wxs
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<ComponentGroup Id="ShortcutComponents">
|
||||
<Component Id="StartMenuFolderShortcut" Directory="StartMenuProgramsFolder" Guid="d21fc601-55f3-44bf-9b36-d0971dd9452d">
|
||||
<Shortcut Id="ApplicationStartMenuShortcut"
|
||||
Name="!(bind.Property.ProductName)"
|
||||
Description="!(bind.Property.ProductName)"
|
||||
Icon="icon.ico"
|
||||
Target="[#Elwig.exe]"
|
||||
WorkingDirectory="InstallFolder"/>
|
||||
<RemoveFolder Id="StartMenuProgramsFolder" On="uninstall"/>
|
||||
<RegistryValue Root="HKCU" Key="Software\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)" Name="start_menu_installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
</Component>
|
||||
|
||||
<Component Id="DesktopFolderShortcut" Directory="DesktopFolder" Guid="b7a88e37-a62f-4c60-9464-bd0b384f9803">
|
||||
<Shortcut Id="DesktopShortcut"
|
||||
Name="!(bind.Property.ProductName)"
|
||||
Description="!(bind.Property.ProductName)"
|
||||
Icon="icon.ico"
|
||||
Target="[#Elwig.exe]"
|
||||
WorkingDirectory="InstallFolder"/>
|
||||
<RegistryValue Root="HKCU" Key="Software\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)" Name="desktop_installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
Reference in New Issue
Block a user