Closed 7enderhead closed 2 years ago
I have more information on this.
In my /usr/local/bin
directory, there was an old leftover link dotnet
to a (now removed old) snap installation of dotnet.
In .NET6, the dotnet command which is tried to be executed in Proces.ForkAndExecProcess(...)
is /usr/share/dotnet/dotnet
, which corresponds to the actual location, reachable by PATH
and also hinted at via environment variable DOTNET_ROOT
.
However, for .NET5 the resolved dotnet command path is /usr/local/bin/dotnet
, the old wrong link.
Removing the old wrong link from /usr/local/bin
solved the problem. Some slight nuance in resolving the pathname between .NET 5 and 6 seems to have caused the issue.
Nice, thanks for following up! #111 should prevent further issues of this type when it's implemented.
Environment
Tested with Microsoft.Build.Locator versions 1.4.1 (released) and self-compiled 1.4.5-gf1cf5647d1 (see comment about instrumentation below).
I am on Linux Mint with several dotnet SDKs installed:
Steps to Reproduce
I want to run
MSBuildLocator.RegisterDefaults()
, which in turn will callDotNetSdkLocationHelper.GetDotNetBasePaths(...)
. In my setup, running this (with an instrumented version, because the original code silently swallows the occurring exception as per comment "this means no dotnet is installed"), leads to an "No such file or directory" exception during the starting of thedotnet --info
process if the invocation occurs from a .NET5 (console) application (TargetFrameworknet5.0
ornetcoreapp5.0
; everything fine from a net6.0 application):The given workingDirectory for
GetDotNetBasePaths
of course exists.Expected Behaviour
invocation of
dotnet --info
works, resulting in parsing of installed dotnet SDKs.Actual Behaviour
exception as described above occurs, is silently "swallowed", eventually leading to an
System.InvalidOperationException
onMSBuildLocator.RegisterDefaults()
, complaining that no instances of MSBuild could be detected.