Make CLISDK MSI set the InstallLocation when bundle does not

We changed the bundle to not pass in default values for DOTNETHOME
because it cannot calculate them in all cases: there is no way to
conditionally set a path which does not exist.  As a result, the MSI
needs to calculate them so that it can write the appropriate defaults.
This commit is contained in:
Eric StJohn 2021-09-15 14:19:41 -07:00
parent 58615fc731
commit 4ce025c05c
2 changed files with 49 additions and 3 deletions

View file

@ -11,11 +11,16 @@
Compressed="yes">
<bal:Condition Message="The installation path for x64 SDK installations: &quot;[DOTNETHOME_X64]&quot; cannot be the same as for x86 SDK installations: &quot;[DOTNETHOME_X86]&quot;">
WixBundleInstalled OR ((NOT (DOTNETHOME_X64 ~= DOTNETHOME_X86)) OR DOTNETHOMESIMILARITYCHECKOVERRIDE)
WixBundleInstalled OR (NOT DOTNETHOME_X64 ~= DOTNETHOME_X86) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
</bal:Condition>
<bal:Condition Message="The installation path for ARM64 SDK installations: &quot;[DOTNETHOME_ARM64]&quot; cannot be the same as for x86 SDK installations: &quot;[DOTNETHOME_X86]&quot;">
WixBundleInstalled OR ((NOT (DOTNETHOME_ARM64 ~= DOTNETHOME_X86)) OR DOTNETHOMESIMILARITYCHECKOVERRIDE)
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X86) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
</bal:Condition>
<!-- Permit same path on non-ARM64 machines since past SDKs always wrote this value -->
<bal:Condition Message="The installation path for ARM64 SDK installations: &quot;[DOTNETHOME_ARM64]&quot; cannot be the same as for x64 SDK installations: &quot;[DOTNETHOME_X64]&quot;">
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X64) OR (NOT NativeProcessorArchitecture=&quot;ARM64&quot;) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
</bal:Condition>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.Foundation">
@ -75,7 +80,6 @@
<!-- Determine native OS architecture -->
<util:RegistrySearch Id="CheckProcessorArchitecture_x64"
After="DotnetInstallLocation_x64"
Condition="NOT DotnetInstallLocationExists_x64"
Variable="NativeProcessorArchitecture"
Result="value"
Root="HKLM"

View file

@ -34,5 +34,47 @@
</RegistryKey>
</Component>
</ComponentGroup>
<!-- Set values for DOTNETHOME if not passed in.
These searches prefer the existing registry key and fallback to probing the default location if registry key isn't present -->
<Property Id="DOTNETHOME_X86_SEARCH">
<DirectorySearch Id="dirDOTNETHOME_X86_search" Path="[ProgramFilesFolder]dotnet" AssignToProperty="yes">
<FileSearch Id="fileDOTNETHOME_X86_search" Name="dotnet.exe" />
</DirectorySearch>
<RegistrySearch Id="regDOTNETHOME_X86_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x86" Name="InstallLocation" Win64="no" Type="raw" />
</Property>
<Property Id="DOTNETHOME_X64_SEARCH">
<DirectorySearch Id="dirDOTNETHOME_X64_search" Path="[ProgramFiles64Folder]dotnet" AssignToProperty="yes">
<FileSearch Id="fileDOTNETHOME_X64_search" Name="dotnet.exe" />
</DirectorySearch>
<RegistrySearch Id="regDOTNETHOME_X64_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64" Name="InstallLocation" Win64="no" Type="raw" />
</Property>
<Property Id="DOTNETHOME_X64_ALT_SEARCH">
<DirectorySearch Id="dirDOTNETHOME_X64_ALT_search" Path="[ProgramFiles64Folder]dotnet\x64" AssignToProperty="yes">
<FileSearch Id="fileDOTNETHOME_X64_ALT_search" Name="dotnet.exe" />
</DirectorySearch>
<RegistrySearch Id="regDOTNETHOME_X64_ALT_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64" Name="InstallLocation" Win64="no" Type="raw" />
</Property>
<Property Id="DOTNETHOME_ARM64_SEARCH">
<DirectorySearch Id="dirDOTNETHOME_ARM64_search" Path="[ProgramFiles64Folder]dotnet" AssignToProperty="yes">
<FileSearch Id="fileDOTNETHOME_ARM64_search" Name="dotnet.exe" />
</DirectorySearch>
<RegistrySearch Id="regDOTNETHOME_ARM64_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\arm64" Name="InstallLocation" Win64="no" Type="raw" />
</Property>
<!-- Set the DOTNETHOME property if not passed in and we found a path -->
<SetProperty Id="DOTNETHOME_X86" Value="[DOTNETHOME_X86_SEARCH]" Before="CostFinalize">
NOT DOTNETHOME_X86 AND DOTNETHOME_X86_SEARCH
</SetProperty>
<SetProperty Id="DOTNETHOME_X64" Value="[DOTNETHOME_X64_SEARCH]" Before="CostFinalize">
NOT DOTNETHOME_X64 AND DOTNETHOME_X64_SEARCH AND %PROCESSOR_ARCHITECTURE="AMD64"
</SetProperty>
<SetProperty Action="Set_DOTNETHOME_X64_alt" Id="DOTNETHOME_X64" Value="[DOTNETHOME_X64_ALT_SEARCH]" Before="CostFinalize">
NOT DOTNETHOME_X64 AND DOTNETHOME_X64_ALT_SEARCH AND NOT %PROCESSOR_ARCHITECTURE="AMD64"
</SetProperty>
<SetProperty Id="DOTNETHOME_ARM64" Value="[DOTNETHOME_ARM64_SEARCH]" Before="CostFinalize">
NOT DOTNETHOME_ARM64 AND DOTNETHOME_ARM64_SEARCH
</SetProperty>
</Fragment>
</Wix>