Skip to content

Commit 4ce025c

Browse files
committed
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.
1 parent 58615fc commit 4ce025c

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

src/redist/targets/packaging/windows/clisdk/bundle.wxs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111
Compressed="yes">
1212

1313
<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;">
14-
WixBundleInstalled OR ((NOT (DOTNETHOME_X64 ~= DOTNETHOME_X86)) OR DOTNETHOMESIMILARITYCHECKOVERRIDE)
14+
WixBundleInstalled OR (NOT DOTNETHOME_X64 ~= DOTNETHOME_X86) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
1515
</bal:Condition>
1616

1717
<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;">
18-
WixBundleInstalled OR ((NOT (DOTNETHOME_ARM64 ~= DOTNETHOME_X86)) OR DOTNETHOMESIMILARITYCHECKOVERRIDE)
18+
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X86) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
19+
</bal:Condition>
20+
21+
<!-- Permit same path on non-ARM64 machines since past SDKs always wrote this value -->
22+
<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;">
23+
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X64) OR (NOT NativeProcessorArchitecture=&quot;ARM64&quot;) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
1924
</bal:Condition>
2025

2126
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.Foundation">
@@ -75,7 +80,6 @@
7580
<!-- Determine native OS architecture -->
7681
<util:RegistrySearch Id="CheckProcessorArchitecture_x64"
7782
After="DotnetInstallLocation_x64"
78-
Condition="NOT DotnetInstallLocationExists_x64"
7983
Variable="NativeProcessorArchitecture"
8084
Result="value"
8185
Root="HKLM"

src/redist/targets/packaging/windows/clisdk/registrykeys.wxs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,47 @@
3434
</RegistryKey>
3535
</Component>
3636
</ComponentGroup>
37+
38+
<!-- Set values for DOTNETHOME if not passed in.
39+
These searches prefer the existing registry key and fallback to probing the default location if registry key isn't present -->
40+
<Property Id="DOTNETHOME_X86_SEARCH">
41+
<DirectorySearch Id="dirDOTNETHOME_X86_search" Path="[ProgramFilesFolder]dotnet" AssignToProperty="yes">
42+
<FileSearch Id="fileDOTNETHOME_X86_search" Name="dotnet.exe" />
43+
</DirectorySearch>
44+
<RegistrySearch Id="regDOTNETHOME_X86_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x86" Name="InstallLocation" Win64="no" Type="raw" />
45+
</Property>
46+
<Property Id="DOTNETHOME_X64_SEARCH">
47+
<DirectorySearch Id="dirDOTNETHOME_X64_search" Path="[ProgramFiles64Folder]dotnet" AssignToProperty="yes">
48+
<FileSearch Id="fileDOTNETHOME_X64_search" Name="dotnet.exe" />
49+
</DirectorySearch>
50+
<RegistrySearch Id="regDOTNETHOME_X64_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64" Name="InstallLocation" Win64="no" Type="raw" />
51+
</Property>
52+
<Property Id="DOTNETHOME_X64_ALT_SEARCH">
53+
<DirectorySearch Id="dirDOTNETHOME_X64_ALT_search" Path="[ProgramFiles64Folder]dotnet\x64" AssignToProperty="yes">
54+
<FileSearch Id="fileDOTNETHOME_X64_ALT_search" Name="dotnet.exe" />
55+
</DirectorySearch>
56+
<RegistrySearch Id="regDOTNETHOME_X64_ALT_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64" Name="InstallLocation" Win64="no" Type="raw" />
57+
</Property>
58+
<Property Id="DOTNETHOME_ARM64_SEARCH">
59+
<DirectorySearch Id="dirDOTNETHOME_ARM64_search" Path="[ProgramFiles64Folder]dotnet" AssignToProperty="yes">
60+
<FileSearch Id="fileDOTNETHOME_ARM64_search" Name="dotnet.exe" />
61+
</DirectorySearch>
62+
<RegistrySearch Id="regDOTNETHOME_ARM64_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\arm64" Name="InstallLocation" Win64="no" Type="raw" />
63+
</Property>
64+
65+
<!-- Set the DOTNETHOME property if not passed in and we found a path -->
66+
<SetProperty Id="DOTNETHOME_X86" Value="[DOTNETHOME_X86_SEARCH]" Before="CostFinalize">
67+
NOT DOTNETHOME_X86 AND DOTNETHOME_X86_SEARCH
68+
</SetProperty>
69+
<SetProperty Id="DOTNETHOME_X64" Value="[DOTNETHOME_X64_SEARCH]" Before="CostFinalize">
70+
NOT DOTNETHOME_X64 AND DOTNETHOME_X64_SEARCH AND %PROCESSOR_ARCHITECTURE="AMD64"
71+
</SetProperty>
72+
<SetProperty Action="Set_DOTNETHOME_X64_alt" Id="DOTNETHOME_X64" Value="[DOTNETHOME_X64_ALT_SEARCH]" Before="CostFinalize">
73+
NOT DOTNETHOME_X64 AND DOTNETHOME_X64_ALT_SEARCH AND NOT %PROCESSOR_ARCHITECTURE="AMD64"
74+
</SetProperty>
75+
<SetProperty Id="DOTNETHOME_ARM64" Value="[DOTNETHOME_ARM64_SEARCH]" Before="CostFinalize">
76+
NOT DOTNETHOME_ARM64 AND DOTNETHOME_ARM64_SEARCH
77+
</SetProperty>
78+
3779
</Fragment>
3880
</Wix>

0 commit comments

Comments
 (0)