Use WIX_NATIVE_MACHINE to detect native architecture of target machine
This commit is contained in:
parent
1a39c5ae6e
commit
dad4407de3
3 changed files with 25 additions and 23 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<!-- Permit same path on non-ARM64 machines since past SDKs always wrote this value -->
|
<!-- Permit same path on non-ARM64 machines since past SDKs always wrote this value -->
|
||||||
<bal:Condition Message="The installation path for ARM64 SDK installations: "[DOTNETHOME_ARM64]" cannot be the same as for x64 SDK installations: "[DOTNETHOME_X64]"">
|
<bal:Condition Message="The installation path for ARM64 SDK installations: "[DOTNETHOME_ARM64]" cannot be the same as for x64 SDK installations: "[DOTNETHOME_X64]"">
|
||||||
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X64) OR (NOT NativeProcessorArchitecture="ARM64") OR DOTNETHOMESIMILARITYCHECKOVERRIDE
|
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X64) OR (NOT NativeMachine="$(var.NativeMachine_arm64)") OR DOTNETHOMESIMILARITYCHECKOVERRIDE
|
||||||
</bal:Condition>
|
</bal:Condition>
|
||||||
|
|
||||||
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.Foundation">
|
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.Foundation">
|
||||||
|
@ -77,20 +77,11 @@
|
||||||
Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64"
|
Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64"
|
||||||
Value="InstallLocation" />
|
Value="InstallLocation" />
|
||||||
|
|
||||||
<!-- Determine native OS architecture -->
|
|
||||||
<util:RegistrySearch Id="CheckProcessorArchitecture_x64"
|
|
||||||
After="DotnetInstallLocation_x64"
|
|
||||||
Variable="NativeProcessorArchitecture"
|
|
||||||
Result="value"
|
|
||||||
Root="HKLM"
|
|
||||||
Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
|
|
||||||
Value="PROCESSOR_ARCHITECTURE" />
|
|
||||||
|
|
||||||
<!-- Check default location when on x64 OS-->
|
<!-- Check default location when on x64 OS-->
|
||||||
<util:FileSearch Id="DotnetExeSearch_x64"
|
<util:FileSearch Id="DotnetExeSearch_x64"
|
||||||
After="CheckProcessorArchitecture_x64"
|
After="DotnetInstallLocation_x64"
|
||||||
Variable="DotnetExeExists_x64"
|
Variable="DotnetExeExists_x64"
|
||||||
Condition="NOT DotnetInstallLocationExists_x64 AND NativeProcessorArchitecture="AMD64""
|
Condition="NOT DotnetInstallLocationExists_x64 AND (NOT NativeMachine OR NativeMachine="$(var.NativeMachine_x64)")"
|
||||||
Result="exists"
|
Result="exists"
|
||||||
Path="[ProgramFiles64Folder]dotnet\dotnet.exe"/>
|
Path="[ProgramFiles64Folder]dotnet\dotnet.exe"/>
|
||||||
<util:DirectorySearch Id="DotnetExeLocation_x64"
|
<util:DirectorySearch Id="DotnetExeLocation_x64"
|
||||||
|
@ -101,9 +92,9 @@
|
||||||
|
|
||||||
<!-- Check alternate location on non-x64 OS -->
|
<!-- Check alternate location on non-x64 OS -->
|
||||||
<util:FileSearch Id="DotnetExeSearch_alt_x64"
|
<util:FileSearch Id="DotnetExeSearch_alt_x64"
|
||||||
After="CheckProcessorArchitecture_x64"
|
After="DotnetInstallLocation_x64"
|
||||||
Variable="DotnetExeExists_alt_x64"
|
Variable="DotnetExeExists_alt_x64"
|
||||||
Condition="NOT DotnetInstallLocationExists_x64 AND NOT NativeProcessorArchitecture="AMD64""
|
Condition="NOT DotnetInstallLocationExists_x64 AND NOT NativeMachine="$(var.NativeMachine_x64)""
|
||||||
Result="exists"
|
Result="exists"
|
||||||
Path="[ProgramFiles64Folder]dotnet\x64\dotnet.exe"/>
|
Path="[ProgramFiles64Folder]dotnet\x64\dotnet.exe"/>
|
||||||
<util:DirectorySearch Id="DotnetExeLocation_alt_x64"
|
<util:DirectorySearch Id="DotnetExeLocation_alt_x64"
|
||||||
|
|
|
@ -5,23 +5,27 @@
|
||||||
<?define Platform = "$(sys.BUILDARCH)"?>
|
<?define Platform = "$(sys.BUILDARCH)"?>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<!-- InstallerArchitecture matches the expected values for PROCESSOR_ARCHITECTURE
|
<!-- InstallerNativeMachine matches the expected values for image file machine constants
|
||||||
https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details -->
|
https://docs.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants -->
|
||||||
<?if $(var.Platform)~=x86?>
|
<?if $(var.Platform)~=x86?>
|
||||||
<?define InstallerArchitecture="X86"?>
|
<?define InstallerNativeMachine=332?>
|
||||||
<?elseif $(var.Platform)~=x64?>
|
<?elseif $(var.Platform)~=x64?>
|
||||||
<?define InstallerArchitecture="AMD64"?>
|
<?define InstallerNativeMachine=34404?>
|
||||||
<?elseif $(var.Platform)~=arm64?>
|
<?elseif $(var.Platform)~=arm64?>
|
||||||
<?define InstallerArchitecture="ARM64"?>
|
<?define InstallerNativeMachine=43620?>
|
||||||
<?else?>
|
<?else?>
|
||||||
<?error Unknown platform, $(var.Platform) ?>?
|
<?error Unknown platform, $(var.Platform) ?>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<!-- Identify when installing in emulation as when PROCESSOR_ARCHITECTURE does not match the installer architecture
|
<!-- Identify when installing in emulation as when WIX_NATIVE_MACHINE does not match the installer
|
||||||
https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details -->
|
native machine (where supported). Also detect running under WOW on x86 using VersionNT64,
|
||||||
|
since WIX_NATIVE_MACHINE cannot be retrieved on older Windows builds. -->
|
||||||
<SetProperty Action="Set_NON_NATIVE_ARCHITECTURE" Id="NON_NATIVE_ARCHITECTURE" Value="true" Before="CostFinalize">
|
<SetProperty Action="Set_NON_NATIVE_ARCHITECTURE" Id="NON_NATIVE_ARCHITECTURE" Value="true" Before="CostFinalize">
|
||||||
NOT %PROCESSOR_ARCHITECTURE="$(var.InstallerArchitecture)"
|
<?if $(var.Platform)~=x86?>
|
||||||
|
VersionNT64 OR
|
||||||
|
<?endif?>
|
||||||
|
WIX_NATIVE_MACHINE AND NOT WIX_NATIVE_MACHINE="$(var.InstallerNativeMachine)"
|
||||||
</SetProperty>
|
</SetProperty>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,14 @@
|
||||||
<?define LCID = "$(var.ProductLanguage)"?>
|
<?define LCID = "$(var.ProductLanguage)"?>
|
||||||
<?define DowngradeErrorMessage = "A newer version is already installed; please uninstall it and re-run setup."?>
|
<?define DowngradeErrorMessage = "A newer version is already installed; please uninstall it and re-run setup."?>
|
||||||
|
|
||||||
|
<!-- NativeMachine values match the expected values for image file machine constants
|
||||||
|
https://docs.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants -->
|
||||||
|
<?define NativeMachine_x86=332?>
|
||||||
|
<?define NativeMachine_x64=34404?>
|
||||||
|
<?define NativeMachine_arm64=43620?>
|
||||||
|
|
||||||
<?define Platform = "$(sys.BUILDARCH)" ?>
|
<?define Platform = "$(sys.BUILDARCH)" ?>
|
||||||
|
|
||||||
<?if $(var.Platform)=x86?>
|
<?if $(var.Platform)=x86?>
|
||||||
<?define PlatformToken="X86"?>
|
<?define PlatformToken="X86"?>
|
||||||
<?define WixQuietExec="WixQuietExec"?>
|
<?define WixQuietExec="WixQuietExec"?>
|
||||||
|
|
Loading…
Reference in a new issue