From 321c30138c82390ea5ad6b0a612dff294203a877 Mon Sep 17 00:00:00 2001 From: StefanStojanovic Date: Tue, 25 Oct 2022 22:40:36 +0200 Subject: Add NetFx .NET compatibility check for MSI (#262) Adds new custom element in NetFx extension for running NetCoreCheck.exe tool from within the MSI installer - ``. The checks are run before evaluating launch conditions, so their results can be used in those conditions. There is no limitation on the number of checks that can be run, so installer may query various runtimes on different platforms and versions and with different roll forward policies. Fixes https://github.com/wixtoolset/issues/issues/6264 --- .../Symbols/NetFxDotNetCompatibilityCheckSymbol.cs | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/ext/NetFx/wixext/Symbols/NetFxDotNetCompatibilityCheckSymbol.cs (limited to 'src/ext/NetFx/wixext/Symbols/NetFxDotNetCompatibilityCheckSymbol.cs') diff --git a/src/ext/NetFx/wixext/Symbols/NetFxDotNetCompatibilityCheckSymbol.cs b/src/ext/NetFx/wixext/Symbols/NetFxDotNetCompatibilityCheckSymbol.cs new file mode 100644 index 00000000..a46cf17f --- /dev/null +++ b/src/ext/NetFx/wixext/Symbols/NetFxDotNetCompatibilityCheckSymbol.cs @@ -0,0 +1,79 @@ +// 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. + +namespace WixToolset.Netfx +{ + using WixToolset.Data; + using WixToolset.Netfx.Symbols; + + public static partial class NetfxSymbolDefinitions + { + public static readonly IntermediateSymbolDefinition NetFxDotNetCompatibilityCheck = new IntermediateSymbolDefinition( + NetfxSymbolDefinitionType.NetFxDotNetCompatibilityCheck.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(NetFxDotNetCompatibilityCheckSymbollFields.RuntimeType), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(NetFxDotNetCompatibilityCheckSymbollFields.Platform), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(NetFxDotNetCompatibilityCheckSymbollFields.Version), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(NetFxDotNetCompatibilityCheckSymbollFields.RollForward), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(NetFxDotNetCompatibilityCheckSymbollFields.Property), IntermediateFieldType.String), + }, + typeof(NetFxDotNetCompatibilityCheckSymbol)); + } +} + +namespace WixToolset.Netfx.Symbols +{ + using WixToolset.Data; + + public enum NetFxDotNetCompatibilityCheckSymbollFields + { + RuntimeType, + Platform, + Version, + RollForward, + Property, + } + + public class NetFxDotNetCompatibilityCheckSymbol : IntermediateSymbol + { + public NetFxDotNetCompatibilityCheckSymbol() : base(NetfxSymbolDefinitions.NetFxDotNetCompatibilityCheck, null, null) + { + } + + public NetFxDotNetCompatibilityCheckSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(NetfxSymbolDefinitions.NetFxDotNetCompatibilityCheck, sourceLineNumber, id) + { + } + + public IntermediateField this[NetFxDotNetCompatibilityCheckSymbollFields index] => this.Fields[(int)index]; + + public string RuntimeType + { + get => this.Fields[(int)NetFxDotNetCompatibilityCheckSymbollFields.RuntimeType].AsString(); + set => this.Set((int)NetFxDotNetCompatibilityCheckSymbollFields.RuntimeType, value); + } + + public string Platform + { + get => this.Fields[(int)NetFxDotNetCompatibilityCheckSymbollFields.Platform].AsString(); + set => this.Set((int)NetFxDotNetCompatibilityCheckSymbollFields.Platform, value); + } + + public string Version + { + get => this.Fields[(int)NetFxDotNetCompatibilityCheckSymbollFields.Version].AsString(); + set => this.Set((int)NetFxDotNetCompatibilityCheckSymbollFields.Version, value); + } + + public string RollForward + { + get => this.Fields[(int)NetFxDotNetCompatibilityCheckSymbollFields.RollForward].AsString(); + set => this.Set((int)NetFxDotNetCompatibilityCheckSymbollFields.RollForward, value); + } + + public string Property + { + get => this.Fields[(int)NetFxDotNetCompatibilityCheckSymbollFields.Property].AsString(); + set => this.Set((int)NetFxDotNetCompatibilityCheckSymbollFields.Property, value); + } + } +} -- cgit v1.2.3-55-g6feb