Add Setup Project
This commit is contained in:
50
Setup/BuildFilesTransform.xslt
Normal file
50
Setup/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
Setup/DocumentTemplateComponents.wxs
Normal file
12
Setup/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.Elwig.ProjectDir)\Documents\style.css" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
41
Setup/DocumentTemplatesTransform.xslt
Normal file
41
Setup/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>
|
4
Setup/Files/config.ini
Normal file
4
Setup/Files/config.ini
Normal file
@ -0,0 +1,4 @@
|
||||
[general]
|
||||
|
||||
[database]
|
||||
file = C:\ProgramData\Elwig\database.sqlite3
|
23
Setup/Folders.wxs
Normal file
23
Setup/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>
|
12
Setup/MainComponents.wxs
Normal file
12
Setup/MainComponents.wxs
Normal file
@ -0,0 +1,12 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<ComponentGroup Id="MainComponents">
|
||||
<Component Directory="InstallFolder">
|
||||
<File Source="$(var.Elwig.ProjectDir)\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>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
8
Setup/Package.de-at.wxl
Normal file
8
Setup/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>
|
18
Setup/Package.wxs
Normal file
18
Setup/Package.wxs
Normal file
@ -0,0 +1,18 @@
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package Name="Elwig" Manufacturer="Elwig" Version="0.1.0" Language="3079" UpgradeCode="a459416a-756a-4be6-b6f4-40872c8425a7" Compressed="true">
|
||||
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
||||
<MediaTemplate EmbedCab="true"/>
|
||||
|
||||
<Icon Id="icon.ico" SourceFile="$(var.Elwig.ProjectDir)\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>
|
45
Setup/Setup.wixproj
Normal file
45
Setup/Setup.wixproj
Normal file
@ -0,0 +1,45 @@
|
||||
<Project Sdk="WixToolset.Sdk/4.0.1">
|
||||
<PropertyGroup>
|
||||
<HarvestFileSuppressUniqueIds>false</HarvestFileSuppressUniqueIds>
|
||||
<HarvestFileGenerateGuidsNow>true</HarvestFileGenerateGuidsNow>
|
||||
<HarvestDirectorySuppressRegistry>false</HarvestDirectorySuppressRegistry>
|
||||
<HarvestDirectoryVerboseOutput>true</HarvestDirectoryVerboseOutput>
|
||||
<HarvestProjectsDirectoryIds>InstallFolder</HarvestProjectsDirectoryIds>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DefineConstants>BuildPath=../Elwig/bin/Publish;DocumentTemplatesPath=../Elwig/Documents</DefineConstants>
|
||||
<PreBuildEvent>curl -s -L "https://unpkg.com/pagedjs/dist/paged.polyfill.js" -o "$(TargetDir)paged.polyfill.js" && dotnet publish "$(SolutionDir)Elwig\Elwig.csproj" "/p:PublishProfile=$(SolutionDir)\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Cultures>de-AT</Cultures>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<ProjectReference Include="..\Elwig\Elwig.csproj" PublishProfile="C:\Users\tom\source\repos\elwig-cs\Elwig\Properties\PublishProfiles\FolderProfile.pubxml" Publish="true" />
|
||||
<PackageReference Include="WixToolset.Heat" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
27
Setup/ShortcutComponents.wxs
Normal file
27
Setup/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