Open rseanhall opened 2 years ago
Duplicate of #6461
Actually wait, maybe not?
@rseanhall can you share a binlog of the passing case?
The failing binlog you shared looks right to me, given your "we have x64 binaries in the x86 folder" situation:
Launching task "WixBuild" from assembly "C:\src\mywix4\build\wix\Debug\publish\WixToolset.Sdk\tools\net472\x86\WixToolset.BuildTasks.dll" in an external task host with a runtime of "CLR4" and a process architecture of "x86".
...
C:\src\mywix4\build\wix\Debug\publish\WixToolset.Sdk\tools\wix.targets(590,5): BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
I can, but why should it matter? The actual tasks DLL, WixToolset.BuildTasks.dll, is AnyCPU. This case is running in 64-bit MSBuild and we are declaring that the 64-bit task is in C:\src\mywix4\build\wix\Debug\publish\WixToolset.Sdk\tools\net472\x64\WixToolset.BuildTasks.dll
so it should be loading that.
@rainersigwald Here are the binlogs when initializing from vsdevcmd.bat
. I will update the original post with the other binlogs later when not initializing from vsdevcmd.bat
. MergeMsiPackage.passing.zip
Issue Description
64-bit MSBuild loads 32-bit task in-proc. Part of the issue here: https://github.com/wixtoolset/issues/issues/6720.
Steps to Reproduce
Binlogs are created in build\logs.
Expected Behavior
All tests pass in the src\wix\test\WixToolsetTest.Sdk project.
Actual Behavior
WixToolsetTest.Sdk.MsbuildFixture.CanBuildSimpleMsiPackageWithMergeModule
test fails in the 64-bit configuration.mergemod.dll
is a native DLL that needs to match the process's architecture and is the one that is causing this failure.Analysis
The test is launching MSBuild from
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe
. We have our tasks defined at https://github.com/rseanhall/wix4/blob/6a3a21a9990020e56acbf930f52b479b5d4d08d4/src/wix/WixToolset.Sdk/tools/wix.targets#L142:WixTasksPath64
is always defined in .NET Framework MSBuild, so the task should be loaded from theWixTasksPath64
path.The very unusual thing about this issue is that it works fine if initializing the command prompt from
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\vsdevcmd.bat
.We have a build process issue that is causing 64-bit dlls to be in the 32-bit folder (
build\wix\Debug\publish\WixToolset.Sdk\tools\net472\x86
). That test should always be failing in the 32-bit configuration, and always passing in the 64-bit configuration. Instead, both configurations are passing when initialized throughvsdevcmd.bat
and both configuration are failing otherwise.Versions & Configurations
msbuild -version
output: Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.17.0.0.52104
Attach a binlog
MergeMsiPackage.MSBuild64.zip MergeMsiPackage.rest.zip