Skip to content

Commit

Permalink
Merged PR 41209: Add support for deferred uninstalls
Browse files Browse the repository at this point in the history
- Updated the standard bootstrapper application, wixstdba:
    - Add a new BA variable, `RemoveUpgradeRelatedBundle` that supports three values: `never`, `nextSession`, and `always`.
    - Bundles are responsible for setting the new BA variable. Setting it to an unsupported value will cause it to default to `always`.
    - `always` enforces the current behavior where older bundles are removed after installing a newer bundle.
    - `never` sets the related bundle action to none and won't remove older upgrade related bundles.
    - `nextSession` sets the related bundle action to `BOOTSTRAPPER_REQUEST_STATE_NEXT_SESSION_ABSENT`. This will cause the engine to write the uninstall command to the RunOnce key and remove the previous version in the next session
- Updated the setup engine, Burn to recognize the new bootstrapper actions.
    - `WriteRunOnceUninstallCommand` is responsible for writing the registry key.
    - `RemoveRunOnceUninstallCommand` is responsible for removing the registry key during a rollback.
    - The registry key is modified by the EXE package engine when it executes the package. This ensures that the operation executes when the engine is elevated and is required because the RunOnce key resides under HKLM in the registry.
- Added support for a new .snk to ensure StrongName signing. Since we do not have access to the private key used by WiX, the .NET copy will sign with a different key, effectively creating a new identity for all the managed binaries in the toolset that differ from the public version of WiX.
- We cannot build the full toolset because that requires build agents to have VS2010, 2012, 2013, and 2015 SDKs installed.
- Added support for generating a NuGet package. The package will retain the Microsoft.Signed.Wix identity we've used for the Microsoft signed copy of the public WiX v3 toolset. This will limit the impact of the change throughout .NET and simplify consuming it in our builds.
- Integrate .NET code signing process. All files will be signed with the Microsoft 3rd Party Application certificate, except for `burn.exe`. The engine should be signed as part of building an installation bundle.
- The copy of `NuGet.exe` has been updated to 6.10.2.8
  • Loading branch information
joeloff committed Sep 13, 2024
1 parent 464c783 commit 8457015
Show file tree
Hide file tree
Showing 31 changed files with 684 additions and 37 deletions.
34 changes: 32 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ trigger:

pr: none

variables:
- name: OfficialBuild
value: true
- name: TestSign
value: false
- name: _TeamName
value: DotNetCore

resources:
repositories:
- repository: 1ESPipelineTemplates
Expand All @@ -28,7 +36,17 @@ extends:
jobs:
- job: build
displayName: Build
timeoutInMinutes: 180
steps:
- task: MicroBuildSigningPlugin@4
displayName: Install MicroBuild plugin
inputs:
signType: real
zipSources: false
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
env:
TeamName: $(_TeamName)
MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)'
- task: MSBuild@1
displayName: Register WiX Toolset StrongName Verification Skipping
inputs:
Expand All @@ -39,12 +57,24 @@ extends:
- script: reg query "HKLM\SOFTWARE\MICROSOFT\WINDOWS KITS\Installed Roots" /s
displayName: List Windows SDKs
- task: MSBuild@1
displayName: Restore
inputs:
solution: 'wix.proj'
msbuildArguments: '/p:Configuration=Release'
msbuildArguments: '/t:Restore'
- task: MSBuild@1
displayName: Build WixRelease
inputs:
solution: '.\tools\release\release.proj'
msbuildArguments: '/p:OfficialBuildPrivateKeyPair=$(System.DefaultWorkingDirectory)\dotnetwix.snk;Configuration=Release;NoPush=true;SkipUploadFiles=true;PleaseSignOutput=true;OfficialBuild=$(OfficialBuild);TestSign=$(TestSign) /bl:$(System.DefaultWorkingDirectory)\build\logs\WixRelease.binlog /p:BuildSandcastleDocumentation=false'
templateContext:
outputs:
- output: pipelineArtifact
displayName: Publish Build Artifacts
artifact: build
path: $(System.DefaultWorkingDirectory)/build
path: $(System.DefaultWorkingDirectory)/build/ship
condition: always()
- output: pipelineArtifact
displayName: Publish Build Logs
artifact: logs
path: $(System.DefaultWorkingDirectory)/build/logs
condition: always()
Binary file added dotnetwix.snk
Binary file not shown.
3 changes: 2 additions & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</config>
<packageSources>
<clear />
<add key="NuGet v3" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
</packageSources>
</configuration>
5 changes: 5 additions & 0 deletions src/DTF/Documents/Reference/dtfref.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
</PropertyGroup>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.props" />

<PropertyGroup>
<NamespaceSummaries>
<NamespaceSummaryItem name="(global)" isDocumented="False" xmlns="" />
Expand Down Expand Up @@ -54,6 +55,10 @@
</DocumentationSources>
</PropertyGroup>

<PropertyGroup>
<ComponentPath>$(SHFBFrameworkROOT)</ComponentPath>
</PropertyGroup>

<ItemGroup>
<Content Include="helplink.js" />
<Content Include="Compression2.png" />
Expand Down
29 changes: 29 additions & 0 deletions src/Setup/NuGet/Microsoft.Signed.Wix.nugetproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->


<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.props" />

<PropertyGroup>
<OutputName>Microsoft.Signed.Wix</OutputName>
<PackageVersion>$(WixSemanticVersion)</PackageVersion>
<ShouldSignOutput>true</ShouldSignOutput>
</PropertyGroup>

<ItemGroup>
<Stage Include="Microsoft.Signed.Wix.props">
<StageSubDirectory>build</StageSubDirectory>
</Stage>
<Stage Include="README.md" />
<Stage Include="MicrosoftDriverInstallFrameworks(DIFx)-Standalone(free)UseTerms.rtf" />
<Stage Include="wix-white-bg.png" />
<Stage Include="$(WixRoot)LICENSE.txt" />
<Stage Include="$(OutputPath)Microsoft.Signed.Wix-$(WixSemanticVersion).zip ">
<StageSubDirectory>tools</StageSubDirectory>
<Unzip>true</Unzip>
</Stage>
</ItemGroup>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" />
</Project>
24 changes: 24 additions & 0 deletions src/Setup/NuGet/Microsoft.Signed.Wix.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>Microsoft.Signed.Wix</id>
<version>1.0.0</version>
<title>WiX: Windows Installer XML Toolset</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MS-RL</license>
<projectUrl>http://wixtoolset.org/</projectUrl>
<icon>wix-white-bg.png</icon>
<readme>README.md</readme>
<description>This package simply bundles the official binaries as a nuget, with all binaries under tools. An MSBuild
.props file automatically resolves a .wixproj targets and paths to that location.
This allows build scripts to just install this package (potentially using -ExcludeVersion) and use it to build MSIs without requiring additional software on a build server.

WiX binaries such as custom action and bootstrapper DLLs have been signed with the Microsoft 3rd Party App SHA2 certificate.
</description>
<summary>The most powerful set of tools available to create your Windows installation experience.</summary>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>FireGiant WiX</tags>
</metadata>
</package>
14 changes: 14 additions & 0 deletions src/Setup/NuGet/Microsoft.Signed.Wix.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WixInstallPath>$(MSBuildThisFileDirectory)..\tools</WixInstallPath>
<WixExtDir>$(WixInstallPath)\</WixExtDir>

<WixTargetsPath>$(WixInstallPath)\wix.targets</WixTargetsPath>
<LuxTargetsPath>$(WixInstallPath)\lux.targets</LuxTargetsPath>

<WixTasksPath>$(WixInstallPath)\WixTasks.dll</WixTasksPath>
<WixSdkPath>$(WixInstallPath)\sdk\</WixSdkPath>
<WixCATargetsPath>$(WixSdkPath)wix.ca.targets</WixCATargetsPath>
</PropertyGroup>
</Project>
Loading

0 comments on commit 8457015

Please sign in to comment.