ionide / proj-info

Parse and evaluate MsBuild project files
MIT License
64 stars 37 forks source link

Add another dotnet runtime detector #203

Closed Smaug123 closed 7 months ago

Smaug123 commented 7 months ago

When running /path/to/dotnet /path/to/analyzers-cli.dll, the $PATH and so forth need not be set up to contain a .NET installation. We can still ask the runtime what's executing it, though.

I checked manually, and with PublishAot RuntimeEnvironment.GetRuntimeDirectory() just returns the directory which contains the binary, rather than throwing or anything like that. I think that's probably the most pathological case we'll have to deal with.

baronfel commented 7 months ago

We likely wouldn't take this, as most other tooling expects dotnet to be set via one of these mechanisms. The spec around this is here: https://github.com/dotnet/designs/blob/main/accepted%2F2021%2Finstall-location-per-architecture.md

IMO Nix should do one of these methods to align better with tooling - the most correct in my opinion is the /etc/.dotnet/install_location method.

Smaug123 commented 7 months ago

This isn't a Nix problem per se, it's just that Nix is an easy way to get hold of a very empty environment. When I run dotnet exec, where dotnet is literally the dotnet that's in the SDK, I kind of expect the invoked tool to be able to discover that it is in fact running; but it's at worst an annoyance not being able to do this.

(I do greatly object to things requiring global mutation of the system they're installed into, but of course we can't do anything about that if .NET demands it!)