Skip to content

Commit d87d0d6

Browse files
[release/6.0] Use WIX_NATIVE_MACHINE to detect native architecture of target machine (dotnet#37335)
* Use WIX_NATIVE_MACHINE to detect native architecture of target machine * Reference WIX_NATIVE_MACHINE property Final bit to resolve what I'm tracking in dotnet#37290 Co-authored-by: Eric StJohn <[email protected]>
1 parent c756a40 commit d87d0d6

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Installers/Windows/Common/dotnethome_x64.wxs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,28 @@
55
<?define Platform = "$(sys.BUILDARCH)"?>
66
<?endif?>
77

8-
<!-- InstallerArchitecture matches the expected values for PROCESSOR_ARCHITECTURE
9-
https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details -->
8+
<!-- InstallerNativeMachine matches the expected values for image file machine constants
9+
https://docs.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants -->
1010
<?if $(var.Platform)~=x86?>
11-
<?define InstallerArchitecture="X86"?>
11+
<?define InstallerNativeMachine=332?>
1212
<?elseif $(var.Platform)~=x64?>
13-
<?define InstallerArchitecture="AMD64"?>
13+
<?define InstallerNativeMachine=34404?>
1414
<?elseif $(var.Platform)~=arm64?>
15-
<?define InstallerArchitecture="ARM64"?>
15+
<?define InstallerNativeMachine=43620?>
1616
<?else?>
17-
<?error Unknown platform, $(var.Platform) ?>?
17+
<?error Unknown platform, $(var.Platform) ?>
1818
<?endif?>
1919

2020
<Fragment>
21-
<!-- Identify when installing in emulation as when PROCESSOR_ARCHITECTURE does not match the installer architecture
22-
https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details -->
21+
<!-- Identify when installing in emulation as when WIX_NATIVE_MACHINE does not match the installer
22+
native machine (where supported). Also detect running under WOW on x86 using VersionNT64,
23+
since WIX_NATIVE_MACHINE cannot be retrieved on older Windows builds. -->
24+
<PropertyRef Id="WIX_NATIVE_MACHINE" />
2325
<SetProperty Action="Set_NON_NATIVE_ARCHITECTURE" Id="NON_NATIVE_ARCHITECTURE" Value="true" Before="CostFinalize">
24-
NOT %PROCESSOR_ARCHITECTURE="$(var.InstallerArchitecture)"
26+
<?if $(var.Platform)~=x86?>
27+
VersionNT64 OR
28+
<?endif?>
29+
WIX_NATIVE_MACHINE AND NOT WIX_NATIVE_MACHINE="$(var.InstallerNativeMachine)"
2530
</SetProperty>
2631
</Fragment>
2732

0 commit comments

Comments
 (0)