@joebigelow / wix-1 / commits / 43109168

Fix the bitness of native binaries for .NET Framework

First, moved the tests build into a separate directory to prevent collisions with shipping code. That requires each test to copy in the required native binaries. Default the native binaries to x64 for testing since we've standardized on VS2022 which is all x64 all the time. Finally, copy the native binaries into the .NET Framework differently from .NET Core because .NET Framework does not support cross-platform thus requires a different layout.

Rob Mensching committed Feb 14, 2022 at 13:39 UTC 4310916863735f641d2aa2e3f44d47c7b08c9d49
9 files changed +56 -20
src/wix/WixToolset.Core.Native/WixToolset.Core.Native.csproj
-7
@@ -24,13 +24,6 @@
24 <ProjectReference Include="..\wixnative\wixnative.vcxproj" ReferenceOutputAssembly="false" PrivateAssets="All" Properties="Platform=x64" />
25 </ItemGroup>
26
27 - <!-- Copy the x64 binaries for unittests since we've standardized on VS2022 (which is 64-bit only) -->
28 - <ItemGroup>
29 - <None Include="..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" />
30 - <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" />
31 - <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.pdb" CopyToOutputDirectory="PreserveNewest" />
32 - </ItemGroup>
33 -
27 <ItemGroup>
28 <PackageReference Include="WixToolset.Data" />
29 <PackageReference Include="System.IO.FileSystem.AccessControl" />
src/wix/test/Directory.Build.props new
+10
@@ -0,0 +1,10 @@
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. -->
3 +
4 +<Project>
5 + <Import Project="..\Directory.Build.props" />
6 +
7 + <PropertyGroup>
8 + <OutputPath>$(OutputPath)test\$(ProjectName)</OutputPath>
9 + </PropertyGroup>
10 +</Project>
src/wix/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj
+7 -1
@@ -6,7 +6,7 @@
6 <TargetFramework>net472</TargetFramework>
7 <IsPackable>false</IsPackable>
8 <DebugType>embedded</DebugType>
9 - <RuntimeIdentifier>win-x86</RuntimeIdentifier>
9 + <RuntimeIdentifier>win-x64</RuntimeIdentifier>
10 <SignOutput>false</SignOutput>
11 </PropertyGroup>
12
@@ -22,6 +22,12 @@
22 <ProjectReference Include="..\..\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj" />
23 </ItemGroup>
24
25 + <!-- Copy the x64 binaries for unittests since we've standardized on VS2022 (which is 64-bit only) -->
26 + <ItemGroup>
27 + <None Include="..\..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" />
28 + <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" />
29 + </ItemGroup>
30 +
31 <ItemGroup>
32 <PackageReference Include="Microsoft.Build.Tasks.Core" />
33 <PackageReference Include="WixBuildTools.TestSupport" />
src/wix/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj
+6
@@ -13,6 +13,12 @@
13 <Content Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
14 </ItemGroup>
15
16 + <!-- Copy the x64 binaries for unittests since we've standardized on VS2022 (which is 64-bit only) -->
17 + <ItemGroup>
18 + <None Include="..\..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" />
19 + <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" />
20 + </ItemGroup>
21 +
22 <ItemGroup>
23 <ProjectReference Include="..\..\WixToolset.Core.Native\WixToolset.Core.Native.csproj" />
24 </ItemGroup>
src/wix/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+6
@@ -13,6 +13,12 @@
13 <Content Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
14 </ItemGroup>
15
16 + <!-- Copy the x64 binaries for unittests since we've standardized on VS2022 (which is 64-bit only) -->
17 + <ItemGroup>
18 + <None Include="..\..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" />
19 + <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" />
20 + </ItemGroup>
21 +
22 <ItemGroup>
23 <ProjectReference Include="..\..\WixToolset.Core\WixToolset.Core.csproj" />
24 <ProjectReference Include="..\..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" />
src/wix/test/WixToolsetTest.Sdk/MsbuildUtilities.cs
+1 -1
@@ -17,7 +17,7 @@ namespace WixToolsetTest.Sdk
17
18 public static class MsbuildUtilities
19 {
20 - public static readonly string WixMsbuildPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(MsbuildUtilities).Assembly.CodeBase).AbsolutePath), "..", "publish", "WixToolset.Sdk");
20 + public static readonly string WixMsbuildPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(MsbuildUtilities).Assembly.CodeBase).AbsolutePath), "..", "..", "..", "publish", "WixToolset.Sdk");
21 public static readonly string WixPropsPath = Path.Combine(WixMsbuildPath, "build", "WixToolset.Sdk.props");
22
23 public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool? outOfProc = null, string verbosityLevel = "normal", bool suppressValidation = true)
src/wix/test/WixToolsetTest.Sdk/WixToolsetTest.Sdk.csproj
+6
@@ -14,6 +14,12 @@
14 <Content Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
15 </ItemGroup>
16
17 + <!-- Copy the x64 binaries for unittests since we've standardized on VS2022 (which is 64-bit only) -->
18 + <ItemGroup>
19 + <None Include="..\..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" />
20 + <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" />
21 + </ItemGroup>
22 +
23 <ItemGroup>
24 <ProjectReference Include="..\..\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj" />
25 </ItemGroup>
src/wix/wix.sln
+4 -4
@@ -1,6 +1,6 @@
1 Microsoft Visual Studio Solution File, Format Version 12.00
2 -# Visual Studio Version 16
3 -VisualStudioVersion = 16.0.31129.286
2 +# Visual Studio Version 17
3 +VisualStudioVersion = 17.0.32112.339
4 MinimumVisualStudioVersion = 15.0.26124.0
5 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Converters", "WixToolset.Converters\WixToolset.Converters.csproj", "{6FAF6385-6598-4B89-972B-C31AFCA14538}"
6 EndProject
@@ -272,8 +272,8 @@ Global
272 {23FC60D7-B101-42F8-9786-DB7A9CD964A2}.Release|x64.Build.0 = Release|Any CPU
273 {23FC60D7-B101-42F8-9786-DB7A9CD964A2}.Release|x86.ActiveCfg = Release|Any CPU
274 {23FC60D7-B101-42F8-9786-DB7A9CD964A2}.Release|x86.Build.0 = Release|Any CPU
275 - {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}.Debug|Any CPU.ActiveCfg = Debug|Win32
276 - {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}.Debug|Any CPU.Build.0 = Debug|Win32
275 + {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}.Debug|Any CPU.ActiveCfg = Debug|x64
276 + {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}.Debug|Any CPU.Build.0 = Debug|x64
277 {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}.Debug|ARM64.ActiveCfg = Debug|ARM64
278 {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}.Debug|ARM64.Build.0 = Debug|ARM64
279 {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}.Debug|x64.ActiveCfg = Debug|x64
src/wix/wix/wix.csproj
+16 -7
@@ -24,18 +24,26 @@
24 <ProjectReference Include="..\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" />
25 </ItemGroup>
26
27 - <ItemGroup Condition=" '$(NCrunch)'=='' ">
28 - <NativeLibrary Include="..\wixnative\Win32\mergemod.dll" RuntimeIdentifier="win-x86" />
27 + <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' and '$(NCrunch)'=='' ">
28 + <!-- Copy the x64 binaries when there is no RuntimeIdentifier since we've standardized on VS2022 (which is 64-bit only) -->
29 + <None Include="..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x64' or '$(RuntimeIdentifier)'=='' " />
30 + <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x64' or '$(RuntimeIdentifier)'=='' " />
31 +
32 + <None Include="..\wixnative\Win32\mergemod.dll" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x86' " />
33 + <None Include="$(BaseOutputPath)$(Configuration)\x86\wixnative.exe" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x86' " />
34 + </ItemGroup>
35 +
36 + <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'!='.NETFramework' and '$(NCrunch)'=='' ">
37 + <NativeLibrary Include="..\wixnative\ARM64\mergemod.dll" RuntimeIdentifier="win-arm64" />
38 <NativeLibrary Include="..\wixnative\x64\mergemod.dll" RuntimeIdentifier="win-x64" />
39 + <NativeLibrary Include="..\wixnative\Win32\mergemod.dll" RuntimeIdentifier="win-x86" />
40 <NativeLibrary Include="$(BaseOutputPath)$(Configuration)\ARM64\wixnative.exe" RuntimeIdentifier="win-arm64" />
41 <NativeLibrary Include="$(BaseOutputPath)$(Configuration)\ARM64\wixnative.pdb" RuntimeIdentifier="win-arm64" />
42 <NativeLibrary Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" RuntimeIdentifier="win-x64" />
43 <NativeLibrary Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.pdb" RuntimeIdentifier="win-x64" />
44 <NativeLibrary Include="$(BaseOutputPath)$(Configuration)\x86\wixnative.exe" RuntimeIdentifier="win-x86" />
45 <NativeLibrary Include="$(BaseOutputPath)$(Configuration)\x86\wixnative.pdb" RuntimeIdentifier="win-x86" />
36 - </ItemGroup>
46
38 - <ItemGroup>
47 <!--
48 This PackageReference is required so the RuntimeTargetsCopyLocalItems have a package (any package would
49 do, WixToolset.Data is as good as any) to "attach" themselves to.
@@ -48,8 +56,9 @@
56 NuGetPackageId="WixToolset.Data"
57 RuntimeIdentifier="%(RuntimeIdentifier)"
58 />
51 - <Content Include="@(RuntimeTargetsCopyLocalItems)"
52 - Link="%(DestinationSubDirectory)\%(FileName)%(Extension)"
53 - CopyToOutputDirectory="PreserveNewest" />
59 + <None Include="@(RuntimeTargetsCopyLocalItems)"
60 + Link="%(DestinationSubDirectory)\%(FileName)%(Extension)"
61 + CopyToOutputDirectory="PreserveNewest" />
62 </ItemGroup>
63 +
64 </Project>