Description
Describe the bug
When using the new SDK hint path feature, the SDK resolver is setting DOTNET_EXPERIMENTAL_HOST_PATH
to the machine-global path instead of the one associated with the resolved SDK.
To Reproduce
In dotnet/msbuild
after dotnet/msbuild#11970 and using an int preview VS with the updated resolver:
❯ msbuild -getProperty:DOTNET_EXPERIMENTAL_HOST_PATH -getProperty:DOTNET_INSTALL_DIR .\src\Framework\ -bl
{
"Properties": {
"DOTNET_EXPERIMENTAL_HOST_PATH": "C:\\Program Files\\dotnet\\dotnet.exe",
"DOTNET_INSTALL_DIR": "S:\\msbuild\\.dotnet\\"
}
}
There's another property that's set correctly DotNetTool = S:\msbuild\.dotnet\dotnet.exe
, but that's not the one the Csc
task chooses to invoke.
If the local SDK is newer than any globally installed one, this can lead to bugs like:
error : You must install or update .NET to run this application.
error :
error : App: S:\msbuild\.dotnet\sdk\10.0.100-preview.6.25302.104\Roslyn\bincore\csc.dll
error : Architecture: x64
error : Framework: 'Microsoft.NETCore.App', version '10.0.0-preview.6.25302.104' (x64)
error : .NET location: C:\Program Files\dotnet\
error :
error : The following frameworks were found:
error : 6.0.36 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
error : 8.0.16 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
error : 8.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
error : 9.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
error : 9.0.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
error : 9.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
error : 10.0.0-preview.5.25277.114 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]