Skip to content

InstallLocation registry keys are not in sync with runtime installation #11999

@ericstj

Description

@ericstj

So this is caused by a combination of factors.

  1. 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" />

  2. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions