Skip to content

Commit

Permalink
Update windows installer
Browse files Browse the repository at this point in the history
- Use sdk-style wix 4.0 project
- Fix installing multiple times
  • Loading branch information
cwensley committed Mar 14, 2023
1 parent 2478158 commit 96ba405
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 201 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ jobs:
with:
dotnet-version: ${{ env.DotNetVersion }}

- uses: microsoft/[email protected]

- name: Build PabloDraw
run: dotnet publish Source/PabloDraw/PabloDraw.csproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw-windows.binlog

- name: Build PabloDraw.Console
run: dotnet publish Source/PabloDraw.Console/PabloDraw.Console.cxproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw.console-windows.binlog

- name: Build msi
run: msbuild ${{ env.BuildParameters }} Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj
run: dotnet build ${{ env.BuildParameters }} Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj

- uses: actions/upload-artifact@v2
with:
Expand Down
5 changes: 3 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@
{
"label": "build-windows-installer",
"type": "shell",
"command": "${input:msbuild}",
"command": "dotnet",
"args": [
"/t:Build",
"build",
"${workspaceFolder}/Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj",
"/p:Configuration=${config:var.BuildConfiguration}",
"/p:GenerateFullPaths=true",
// "/p:BuildBranch=refs/tags/3.0.13-beta4",
"/v:Minimal",
"/consoleloggerparameters:NoSummary"
],
Expand Down
8 changes: 5 additions & 3 deletions Source/Pablo Desktop.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
EmbedReferences.targets = EmbedReferences.targets
PabloDraw.Console\PabloDraw.Console.cxproj = PabloDraw.Console\PabloDraw.Console.cxproj
EndProjectSection
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "PabloDraw.WindowsInstaller", "PabloDraw.WindowsInstaller\PabloDraw.WindowsInstaller.wixproj", "{38A42F6D-A417-45B0-8EC8-A700F31CBE26}"
Expand Down Expand Up @@ -78,10 +79,11 @@ Global
{3FAACC7E-D156-4599-B0D1-6177AD78E8B1}.Release|x64.Build.0 = Release|Any CPU
{3FAACC7E-D156-4599-B0D1-6177AD78E8B1}.Release|x86.ActiveCfg = Release|Any CPU
{3FAACC7E-D156-4599-B0D1-6177AD78E8B1}.Release|x86.Build.0 = Release|Any CPU
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|Any CPU.ActiveCfg = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|Any CPU.ActiveCfg = Debug|x64
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|Any CPU.Build.0 = Debug|x64
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|Mac.ActiveCfg = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|x64.ActiveCfg = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|x64.Build.0 = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|x64.ActiveCfg = Debug|x64
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|x64.Build.0 = Debug|x64
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|x86.ActiveCfg = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Debug|x86.Build.0 = Debug|x86
{38A42F6D-A417-45B0-8EC8-A700F31CBE26}.Release|Any CPU.ActiveCfg = Release|x86
Expand Down
36 changes: 7 additions & 29 deletions Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\Directory.Build.props" />
<Project Sdk="WixToolset.Sdk/4.0.0-rc.3">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>38a42f6d-a417-45b0-8ec8-a700f31cbe26</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>PabloDraw-Windows-x64</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<DefineConstants>PublishDir=$(PublishDir)</DefineConstants>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<OutputPath>$(ArtifactsDir)installer\$(Configuration)\$(BuildTarget)\</OutputPath>
<PublishReferences Condition="$(PublishReferences) == ''">True</PublishReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DefineConstants>$(DefineConstants);Debug</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PabloDraw\PabloDraw.csproj">
<Name>PabloDraw</Name>
Expand All @@ -39,21 +22,16 @@
<IsDotnetSDKProject>True</IsDotnetSDKProject>
</ProjectReference>
</ItemGroup>

<Import Project="$(WixTargetsPath)" />
<Import Project="..\Directory.Build.targets" />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>

<Target Name="SetAssemblyVersion" BeforeTargets="BeforeBuild">
<Message Importance="high" Text="Building Version: $(AssemblyVersion)" />
<PropertyGroup>
<DefineConstants>$(DefineConstants);Version=$(AssemblyVersion)</DefineConstants>
<ProductVersion Condition="$(ProductVersion) == ''">$(AssemblyVersion)</ProductVersion>
<ProductVersion Condition="$(ProductVersion) == ''">$(Version)</ProductVersion>
<ProductVersion Condition="$(ProductVersion.IndexOf('-')) > 0">$(ProductVersion.Substring(0, $(ProductVersion.IndexOf('-'))))</ProductVersion>
<DefineConstants>$(DefineConstants);Version=$(ProductVersion)</DefineConstants>
</PropertyGroup>
<Message Importance="high" Text="Building Version: $(ProductVersion)" />
</Target>

<Target Name="BeforeBuild" Condition="$(PublishReferences) == 'True'">
<Target Name="PublishPabloDraw" BeforeTargets="BeforeBuild" Condition="$(PublishReferences) == 'True'">
<Exec WorkingDirectory="%(ProjectReference.RootDir)%(ProjectReference.Directory)" Command="dotnet publish -c $(Configuration)" Condition="'%(ProjectReference.IsDotnetSDKProject)' == 'True'" />
<!-- <ItemGroup>
<LinkerBindInputPaths Include="%(ProjectReference.PublishDir)" />
Expand Down
Loading

0 comments on commit 96ba405

Please sign in to comment.