So this is caused by a combination of factors.
-
The SDK bundle always sets DOTNETHOME_ARCH values
|
<Variable Name="DOTNETHOME_X86" Type="string" Value="[ProgramFilesFolder]dotnet" bal:Overridable="yes" /> |
|
<Variable Name="DOTNETHOME_X64" Type="string" Value="[ProgramFiles64Folder]dotnet" bal:Overridable="yes" /> |
|
<Variable Name="DOTNETHOME_ARM64" Type="string" Value="[ProgramFiles64Folder]dotnet" bal:Overridable="yes" /> |
-
The registry keys for all architectures are included in every MSI:
|
<Component Id="DotnetInstallLocation_arm64" Directory="TARGETDIR" Win64="no"> |
|
<Condition>VersionNT64 AND DOTNETHOME_ARM64</Condition> |
|
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\arm64"> |
|
<RegistryValue Action="write" Name="InstallLocation" Type="string" Value="[DOTNETHOME_ARM64]" KeyPath="yes"/> |
|
</RegistryKey> |
|
</Component> |
|
<Component Id="DotnetInstallLocation_x64" Directory="TARGETDIR" Win64="no"> |
|
<Condition>VersionNT64 AND DOTNETHOME_X64</Condition> |
|
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64"> |
|
<RegistryValue Action="write" Name="InstallLocation" Type="string" Value="[DOTNETHOME_X64]" KeyPath="yes"/> |
|
</RegistryKey> |
|
</Component> |
|
<Component Id="DotnetInstallLocation_x86" Directory="TARGETDIR" Win64="no"> |
|
<Condition>DOTNETHOME_X86</Condition> |
|
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x86"> |
|
<RegistryValue Action="write" Name="InstallLocation" Type="string" Value="[DOTNETHOME_X86]" KeyPath="yes"/> |
|
</RegistryKey> |
|
</Component> |
This is partly fixed by my PR to remove the defaults from the bundle. This also added some logic in the MSI when values aren't present to only set them if dotnet.exe actually exists, however another characteristic is that the bundle and MSI will preserve past entries.
We could try to fix this by only preserving past registry entries if they point to actual copies of dotnet.exe. That wouldn't be enough since the x64/ARM64 paths were busted previously.
We could ignore this under the premise of ARM64 doesn't support previous builds of x64 installers (and I added a blocker in the installation that might force someone to uninstall it). The ARM64 key would still be present on x64, but maybe could fix that too by conditioning the key to not install if the native machine was ARM64.
Thoughts?
So this is caused by a combination of factors.
The SDK bundle always sets DOTNETHOME_ARCH values
installer/src/redist/targets/packaging/windows/clisdk/bundle.wxs
Lines 124 to 126 in 5c6d74b
The registry keys for all architectures are included in every MSI:
installer/src/redist/targets/packaging/windows/clisdk/registrykeys.wxs
Lines 18 to 35 in 5c6d74b
This is partly fixed by my PR to remove the defaults from the bundle. This also added some logic in the MSI when values aren't present to only set them if
dotnet.exeactually exists, however another characteristic is that the bundle and MSI will preserve past entries.We could try to fix this by only preserving past registry entries if they point to actual copies of dotnet.exe. That wouldn't be enough since the x64/ARM64 paths were busted previously.
We could ignore this under the premise of ARM64 doesn't support previous builds of x64 installers (and I added a blocker in the installation that might force someone to uninstall it). The ARM64 key would still be present on x64, but maybe could fix that too by conditioning the key to not install if the native machine was ARM64.
Thoughts?