aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-05 21:27:11 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-05 21:51:07 +1000
commitaecff401f974f603cb78b8a665000b2a93490e80 (patch)
treeeb7e442f26e17cb81e7f232de145d22fdcace0eb
parent057da4cedb151761c4a8cbfe9c1899315c8a3b05 (diff)
downloadwix-aecff401f974f603cb78b8a665000b2a93490e80.tar.gz
wix-aecff401f974f603cb78b8a665000b2a93490e80.tar.bz2
wix-aecff401f974f603cb78b8a665000b2a93490e80.zip
Modernize NetfxCompiler and table definitions.
-rw-r--r--src/Directory.Build.props4
-rw-r--r--src/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj15
-rw-r--r--src/wixext/NetFxCompiler.cs12
-rw-r--r--src/wixext/NetfxTableDefinitions.cs29
-rw-r--r--src/wixext/NetfxWindowsInstallerBackendExtension.cs18
-rw-r--r--src/wixlib/netfx.wixproj4
-rw-r--r--src/wixlib/packages.config2
7 files changed, 48 insertions, 36 deletions
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index e853e22d..a22f4470 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -8,6 +8,7 @@
8 <PropertyGroup> 8 <PropertyGroup>
9 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 9 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
10 <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink> 10 <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink>
11 <MSBuildWarningsAsMessages>MSB3246</MSBuildWarningsAsMessages>
11 12
12 <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName> 13 <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
13 <BaseOutputPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\))</BaseOutputPath> 14 <BaseOutputPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\))</BaseOutputPath>
@@ -21,6 +22,7 @@
21 <Product>WiX Toolset</Product> 22 <Product>WiX Toolset</Product>
22 </PropertyGroup> 23 </PropertyGroup>
23 24
24 <Import Project="Cpp.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.vcxproj' " /> 25 <Import Project="Cpp.Build.props" Condition=" Exists('Cpp.Build.props') And '$(MSBuildProjectExtension)'=='.vcxproj' " />
26 <Import Project="Wix.Build.props" Condition=" Exists('Wix.Build.props') And '$(MSBuildProjectExtension)'=='.wixproj' " />
25 <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " /> 27 <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " />
26</Project> 28</Project>
diff --git a/src/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj b/src/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj
index 4c2e1444..88303fcd 100644
--- a/src/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj
+++ b/src/test/WixToolsetTest.Netfx/WixToolsetTest.Netfx.csproj
@@ -3,7 +3,7 @@
3 3
4<Project Sdk="Microsoft.NET.Sdk"> 4<Project Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup> 5 <PropertyGroup>
6 <TargetFramework>netcoreapp2.1</TargetFramework> 6 <TargetFramework>netcoreapp3.1</TargetFramework>
7 <IsPackable>false</IsPackable> 7 <IsPackable>false</IsPackable>
8 </PropertyGroup> 8 </PropertyGroup>
9 9
@@ -23,10 +23,10 @@
23 </ItemGroup> 23 </ItemGroup>
24 24
25 <ItemGroup> 25 <ItemGroup>
26 <PackageReference Include="WixToolset.Core" Version="4.0.*" PrivateAssets="all" /> 26 <PackageReference Include="WixToolset.Core" Version="4.0.*" />
27 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" PrivateAssets="all" /> 27 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
28 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" PrivateAssets="all" /> 28 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
29 <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" PrivateAssets="all" /> 29 <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" />
30 </ItemGroup> 30 </ItemGroup>
31 31
32 <ItemGroup> 32 <ItemGroup>
@@ -36,9 +36,6 @@
36 <ItemGroup> 36 <ItemGroup>
37 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> 37 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
38 <PackageReference Include="xunit" Version="2.4.1" /> 38 <PackageReference Include="xunit" Version="2.4.1" />
39 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> 39 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
40 <PrivateAssets>all</PrivateAssets>
41 <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
42 </PackageReference>
43 </ItemGroup> 40 </ItemGroup>
44</Project> 41</Project>
diff --git a/src/wixext/NetFxCompiler.cs b/src/wixext/NetFxCompiler.cs
index 4916994e..58c8c0f6 100644
--- a/src/wixext/NetFxCompiler.cs
+++ b/src/wixext/NetFxCompiler.cs
@@ -53,14 +53,14 @@ namespace WixToolset.Netfx
53 /// <param name="fileId">The file identifier of the parent element.</param> 53 /// <param name="fileId">The file identifier of the parent element.</param>
54 private void ParseNativeImageElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId) 54 private void ParseNativeImageElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId)
55 { 55 {
56 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 56 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
57 Identifier id = null; 57 Identifier id = null;
58 string appBaseDirectory = null; 58 string appBaseDirectory = null;
59 string assemblyApplication = null; 59 string assemblyApplication = null;
60 int attributes = 0x8; // 32bit is on by default 60 int attributes = 0x8; // 32bit is on by default
61 int priority = 3; 61 int priority = 3;
62 62
63 foreach (XAttribute attrib in element.Attributes()) 63 foreach (var attrib in element.Attributes())
64 { 64 {
65 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 65 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
66 { 66 {
@@ -75,7 +75,7 @@ namespace WixToolset.Netfx
75 // See if a formatted value is specified. 75 // See if a formatted value is specified.
76 if (-1 == appBaseDirectory.IndexOf("[", StringComparison.Ordinal)) 76 if (-1 == appBaseDirectory.IndexOf("[", StringComparison.Ordinal))
77 { 77 {
78 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Directory", appBaseDirectory); 78 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, appBaseDirectory);
79 } 79 }
80 break; 80 break;
81 case "AssemblyApplication": 81 case "AssemblyApplication":
@@ -84,7 +84,7 @@ namespace WixToolset.Netfx
84 // See if a formatted value is specified. 84 // See if a formatted value is specified.
85 if (-1 == assemblyApplication.IndexOf("[", StringComparison.Ordinal)) 85 if (-1 == assemblyApplication.IndexOf("[", StringComparison.Ordinal))
86 { 86 {
87 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", assemblyApplication); 87 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, assemblyApplication);
88 } 88 }
89 break; 89 break;
90 case "Debug": 90 case "Debug":
@@ -140,7 +140,7 @@ namespace WixToolset.Netfx
140 140
141 if (null == id) 141 if (null == id)
142 { 142 {
143 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 143 id = this.ParseHelper.CreateIdentifier("nni", fileId);
144 } 144 }
145 145
146 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 146 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
@@ -149,7 +149,7 @@ namespace WixToolset.Netfx
149 149
150 if (!this.Messaging.EncounteredError) 150 if (!this.Messaging.EncounteredError)
151 { 151 {
152 section.Tuples.Add(new NetFxNativeImageTuple(sourceLineNumbers, id) 152 section.AddTuple(new NetFxNativeImageTuple(sourceLineNumbers, id)
153 { 153 {
154 FileRef = fileId, 154 FileRef = fileId,
155 Priority = priority, 155 Priority = priority,
diff --git a/src/wixext/NetfxTableDefinitions.cs b/src/wixext/NetfxTableDefinitions.cs
new file mode 100644
index 00000000..378f6def
--- /dev/null
+++ b/src/wixext/NetfxTableDefinitions.cs
@@ -0,0 +1,29 @@
1// 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.
2
3namespace WixToolset.Netfx
4{
5 using WixToolset.Data.WindowsInstaller;
6
7 public static class NetfxTableDefinitions
8 {
9 public static readonly TableDefinition NetFxNativeImage = new TableDefinition(
10 "Wix4NetFxNativeImage",
11 new[]
12 {
13 new ColumnDefinition("Wix4NetFxNativeImage", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The primary key, a non-localized token.", modularizeType: ColumnModularizeType.Column),
14 new ColumnDefinition("File_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "File", keyColumn: 1, description: "The assembly for which a native image will be generated.", modularizeType: ColumnModularizeType.Column),
15 new ColumnDefinition("Priority", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Integer, minValue: 0, maxValue: 3, description: "The priority for generating this native image: 0 is syncronous, 1-3 represent various levels of queued generation."),
16 new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Integer, minValue: 0, maxValue: 2147483647, description: "Integer containing bit flags representing native image attributes."),
17 new ColumnDefinition("File_Application", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The application which loads this assembly.", modularizeType: ColumnModularizeType.Column),
18 new ColumnDefinition("Directory_ApplicationBase", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The directory containing the application which loads this assembly.", modularizeType: ColumnModularizeType.Column),
19 },
20 tupleDefinitionName: "NetFxNativeImage",
21 tupleIdIsPrimaryKey: true
22 );
23
24 public static readonly TableDefinition[] All = new[]
25 {
26 NetFxNativeImage,
27 };
28 }
29}
diff --git a/src/wixext/NetfxWindowsInstallerBackendExtension.cs b/src/wixext/NetfxWindowsInstallerBackendExtension.cs
index 7e30d396..e1404c1a 100644
--- a/src/wixext/NetfxWindowsInstallerBackendExtension.cs
+++ b/src/wixext/NetfxWindowsInstallerBackendExtension.cs
@@ -8,22 +8,6 @@ namespace WixToolset.Netfx
8 8
9 public class NetfxWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension 9 public class NetfxWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension
10 { 10 {
11 private static readonly TableDefinition[] Tables = new[] { 11 public override IEnumerable<TableDefinition> TableDefinitions => NetfxTableDefinitions.All;
12 new TableDefinition(
13 "Wix4NetFxNativeImage",
14 "NetFxNativeImage",
15 new[]
16 {
17 new ColumnDefinition("Wix4NetFxNativeImage", ColumnType.String, 72, true, false, ColumnCategory.Identifier, description: "The primary key, a non-localized token."),
18 new ColumnDefinition("File_", ColumnType.String, 0, false, false, ColumnCategory.Identifier, keyTable:"File", keyColumn: 1, description: "The assembly for which a native image will be generated."),
19 new ColumnDefinition("Priority", ColumnType.Number, 2, false, false, ColumnCategory.Integer, maxValue: 3, description: "The priority for generating this native image: 0 is syncronous, 1-3 represent various levels of queued generation."),
20 new ColumnDefinition("Attributes", ColumnType.Number, 4, false, false, ColumnCategory.Integer, maxValue: 2147483647, description: "Integer containing bit flags representing native image attributes."),
21 new ColumnDefinition("File_Application", ColumnType.String, 72, false, true, ColumnCategory.Formatted, description: "The application which loads this assembly."),
22 new ColumnDefinition("Directory_ApplicationBase", ColumnType.String, 72, false, true, ColumnCategory.Formatted, description: "The directory containing the application which loads this assembly."),
23 }
24 ),
25 };
26
27 public override IEnumerable<TableDefinition> TableDefinitions { get => Tables; }
28 } 12 }
29} 13}
diff --git a/src/wixlib/netfx.wixproj b/src/wixlib/netfx.wixproj
index aefce69b..62a35745 100644
--- a/src/wixlib/netfx.wixproj
+++ b/src/wixlib/netfx.wixproj
@@ -1,7 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. --> 2<!-- 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. -->
3<Project DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0"> 3<Project DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
4 <Import Project="..\..\packages\WixToolset.MSBuild.4.0.0-build-0082\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0082\build\WixToolset.MSBuild.props')" /> 4 <Import Project="..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props')" />
5 <Import Project="..\FindLocalWix.props" /> 5 <Import Project="..\FindLocalWix.props" />
6 <PropertyGroup> 6 <PropertyGroup>
7 <ProjectGuid>{45e4a6ac-3190-4e17-83f0-9935ffa5dc2b}</ProjectGuid> 7 <ProjectGuid>{45e4a6ac-3190-4e17-83f0-9935ffa5dc2b}</ProjectGuid>
@@ -45,7 +45,7 @@
45 <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> 45 <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
46 </PropertyGroup> 46 </PropertyGroup>
47 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" /> 47 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
48 <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0082\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0082\build\WixToolset.MSBuild.props'))" /> 48 <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0083\build\WixToolset.MSBuild.props'))" />
49 <Error Condition="!Exists('..\..\packages\WixToolset.Util.wixext.4.0.27\build\WixToolset.Util.wixext.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.Util.wixext.4.0.27\build\WixToolset.Util.wixext.targets'))" /> 49 <Error Condition="!Exists('..\..\packages\WixToolset.Util.wixext.4.0.27\build\WixToolset.Util.wixext.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.Util.wixext.4.0.27\build\WixToolset.Util.wixext.targets'))" />
50 </Target> 50 </Target>
51 <Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" /> 51 <Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
diff --git a/src/wixlib/packages.config b/src/wixlib/packages.config
index a543c00f..d7f7cfd7 100644
--- a/src/wixlib/packages.config
+++ b/src/wixlib/packages.config
@@ -1,6 +1,6 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<packages> 2<packages>
3 <package id="Nerdbank.GitVersioning" version="2.1.65" developmentDependency="true" targetFramework="net40" /> 3 <package id="Nerdbank.GitVersioning" version="2.1.65" developmentDependency="true" targetFramework="net40" />
4 <package id="WixToolset.MSBuild" version="4.0.0-build-0082" developmentDependency="true" targetFramework="net40" /> 4 <package id="WixToolset.MSBuild" version="4.0.0-build-0083" developmentDependency="true" targetFramework="net40" />
5 <package id="WixToolset.Util.wixext" version="4.0.27" targetFramework="net40" /> 5 <package id="WixToolset.Util.wixext" version="4.0.27" targetFramework="net40" />
6</packages> \ No newline at end of file 6</packages> \ No newline at end of file