Moved building MSI to Installer and created Bootstrapper in Setup

This commit is contained in:
2023-08-21 19:43:29 +02:00
parent 4aa8fe2e2d
commit 0e13e269d0
13 changed files with 129 additions and 48 deletions

View File

@ -6,7 +6,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elwig", "Elwig\Elwig.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{30D7700A-7B0A-4E5D-B839-B4C1D95E307E}"
EndProject
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "Setup", "Setup\Setup.wixproj", "{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}"
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "Installer", "Installer\Installer.wixproj", "{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}"
EndProject
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "Setup", "Setup\Setup.wixproj", "{952E309C-2090-4978-8996-65900D8E8FA4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -68,6 +70,22 @@ Global
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|x64.Build.0 = Release|x64
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|x86.ActiveCfg = Release|x86
{4A82C9C0-EB6D-409C-B0B2-09A5F727D16F}.Release|x86.Build.0 = Release|x86
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|Any CPU.ActiveCfg = Debug|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|Any CPU.Build.0 = Debug|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|ARM64.ActiveCfg = Debug|ARM64
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|ARM64.Build.0 = Debug|ARM64
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|x64.ActiveCfg = Debug|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|x64.Build.0 = Debug|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|x86.ActiveCfg = Debug|x86
{952E309C-2090-4978-8996-65900D8E8FA4}.Debug|x86.Build.0 = Debug|x86
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|Any CPU.ActiveCfg = Release|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|Any CPU.Build.0 = Release|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|ARM64.ActiveCfg = Release|ARM64
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|ARM64.Build.0 = Release|ARM64
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|x64.ActiveCfg = Release|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|x64.Build.0 = Release|x64
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|x86.ActiveCfg = Release|x86
{952E309C-2090-4978-8996-65900D8E8FA4}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -5,7 +5,7 @@
<File Source="$(TargetDir)\paged.polyfill.js" />
</Component>
<Component>
<File Source="$(var.Elwig.ProjectDir)\Documents\style.css" />
<File Source="$(var.ElwigProjectDir)\Documents\style.css" />
</Component>
</ComponentGroup>
</Fragment>

View 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 &quot;https://unpkg.com/pagedjs/dist/paged.polyfill.js&quot; -o &quot;$(TargetDir)paged.polyfill.js&quot;" />
<Exec Command="curl -s &quot;http://www.columbia.edu/~em36/PDFtoPrinter.exe&quot; -z &quot;$(TargetDir)PDFtoPrinter.exe&quot; -o &quot;$(TargetDir)PDFtoPrinter.exe&quot;" />
<Exec Command="dotnet publish &quot;$(SolutionDir)Elwig\Elwig.csproj&quot; &quot;/p:PublishProfile=$(SolutionDir)\Elwig\Properties\PublishProfiles\FolderProfile.pubxml&quot;" />
<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>

View File

@ -2,7 +2,7 @@
<Fragment>
<ComponentGroup Id="MainComponents">
<Component Directory="InstallFolder">
<File Source="$(var.Elwig.ProjectDir)\bin\Publish\Elwig.exe" Id="Elwig.exe"/>
<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"/>

View File

@ -1,9 +1,9 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="Elwig" Manufacturer="Elwig" Version="!(bind.FileVersion.Elwig.exe)" Language="3079" UpgradeCode="a459416a-756a-4be6-b6f4-40872c8425a7" Compressed="true">
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<MediaTemplate EmbedCab="true"/>
<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.Elwig.ProjectDir)\elwig.ico"/>
<Icon Id="icon.ico" SourceFile="$(var.ElwigProjectDir)\elwig.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico"/>
<Feature Id="Main">

25
Setup/Bundle.wxs Normal file
View File

@ -0,0 +1,25 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
<Bundle Name="Elwig" Manufacturer="Elwig" Version="!(bind.packageVersion.ElwigMsi)" UpgradeCode="f3c8fcab-c37c-43aa-9ab8-e42f4bb518b7" IconSourceFile="$(var.ElwigProjectDir)\elwig.ico" >
<BootstrapperApplication>
<bal:WixStandardBootstrapperApplication LicenseUrl="" Theme="hyperlinkLicense" LogoFile="$(var.ElwigProjectDir)\elwig.png" SuppressOptionsUI="yes" ShowVersion="yes" />
</BootstrapperApplication>
<util:RegistrySearch Id="VCredistx86" Variable="VCredistx86" Result="exists" Root="HKLM" Key="SOFTWARE\Classes\Installer\Dependencies\VC,redist.x86,x86,14.36,bundle" />
<util:RegistrySearch Id="Webview2Machine" Variable="Webview2Machine" Result="exists" Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" />
<util:RegistrySearch Id="Webview2User" Variable="Webview2User" Result="exists" Root="HKCU" Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" />
<Chain>
<ExePackage Id="VCredistx86Installer" DisplayName="VC Redist x86 installer" Name="VC_redist.x86.exe" Cache="remove" Compressed="yes" PerMachine="yes"
Permanent="yes" Vital="yes" SourceFile="$(TargetDir)VC_redist.x86.exe" InstallArguments="/install /passive /norestart" DetectCondition="VCredistx86">
</ExePackage>
<ExePackage Id="MicrosoftEdgeWebview2" DisplayName="Microsoft Edge Webview2 Runtime" Name="MicrosoftEdgeWebview2Setup.exe" Cache="remove"
Compressed="yes" PerMachine="yes" Permanent ="yes" Vital ="no" SourceFile="$(TargetDir)MicrosoftEdgeWebview2Setup.exe" InstallArguments="/silent /install"
UninstallArguments="/silent /uninstall" DetectCondition="Webview2Machine OR Webview2User" >
</ExePackage>
<MsiPackage Id="ElwigMsi" SourceFile="$(var.Installer.TargetDir)\Elwig.msi" Permanent="no" Compressed="yes" Vital="yes"/>
</Chain>
</Bundle>
</Wix>

View File

@ -1,47 +1,19 @@
<Project Sdk="WixToolset.Sdk/4.0.1">
<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" &amp; curl -s "http://www.columbia.edu/~em36/PDFtoPrinter.exe" -z "$(TargetDir)PDFtoPrinter.exe" -o "$(TargetDir)PDFtoPrinter.exe" &amp; dotnet publish "$(SolutionDir)Elwig\Elwig.csproj" "/p:PublishProfile=$(SolutionDir)\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"</PreBuildEvent>
<OutputType>Bundle</OutputType>
<OutputName>Elwig</OutputName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Cultures>de-AT</Cultures>
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
<Exec Command='curl -L -s "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -z "$(TargetDir)MicrosoftEdgeWebview2Setup.exe" -o "$(TargetDir)MicrosoftEdgeWebview2Setup.exe"' />
<Exec Command='curl -L -s "https://aka.ms/vs/17/release/vc_redist.x86.exe" -z "$(TargetDir)VC_redist.x86.exe" -o "$(TargetDir)VC_redist.x86.exe"' />
<PropertyGroup>
<DefineConstants>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" />
<ProjectReference Include="..\Installer\Installer.wixproj" />
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.1" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.1" />
</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="..\Elwig\Properties\PublishProfiles\FolderProfile.pubxml" Publish="true" />
<PackageReference Include="WixToolset.Heat" Version="4.0.1" />
</ItemGroup>
</Project>
</Project>