DotNetVersions icon indicating copy to clipboard operation
DotNetVersions copied to clipboard

Make into a `dotnet` tool?

Open derekantrican opened this issue 3 years ago • 9 comments

The dotnet CLI has a handy feature of "tools" (like extensions). I could see this being a very useful one. It would make your tool very easy to install & use.

https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create

derekantrican avatar Jan 24 '22 20:01 derekantrican

Hi Derek:

In fact you already have this built-in in dotnet: dotnet --list-sdks

This will give you all the installed .NET SDK versions in your computer.

If you want to know all the installed .NET runtimes you can use: dotnet --list-runtimes

The whole point of creating my tool was to have something similar in the "classic" .NET framework, where knowing this information is not straightforward.

HTH

jmalarcon avatar Jan 25 '22 07:01 jmalarcon

Yes, I am aware of dotnet --list-runtimes but this only lists the .NET Core runtimes (now just called ".NET"). That is why I suggested to you to build a tool using your code: for .NET Framework runtimes

derekantrican avatar Jan 25 '22 15:01 derekantrican

Ah!, OK. So what you're proposing, if I understood it correctly, is to create a .NET version that apart from showing the same that --list-runtimes shows, it includes the old .NET framework versions too in the result. Is that correct?

It shouldn't be difficult to pull out in Windows with the Microsoft.Win32.Registry package, I guess. It should return the same as --list-runtimes + .NET framework versions in Windows, and just the same as --list-runtimes in other operating systems...

Thanks for the suggestion.

jmalarcon avatar Jan 25 '22 15:01 jmalarcon

Right. Per my links above, I think this would fit well as a "tool" that could be called via the dotnet CLI. Currently to see a list of installed .NET Frameworks on a computer, a user has to run something like

Powershell

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version,Release -EA 0 | Where { $_.PSChildName -match '^(?!S)\p{L}'} | Select PSChildName, Version, Release

https://stackoverflow.com/a/3495491/2246411

which is horrendous. Additionally, everywhere I look there seems to be caveats for 4.5+ or <=1 because of how the registry is organized differently for those versions. Someone could install your tool, but that's an additional thing to install.

However, if they happen to already have the dotnet CLI installed, I think it would be cool if they could run something like the following:

dotnet tool install list-frameworks
dotnet tool list-frameworks

Much simpler. Much cleaner.

derekantrican avatar Jan 25 '22 15:01 derekantrican

You're right. Thanks for the suggestion.

I don't know I I'll have the time soon to do something like that, but I keep the idea here for doing sometime in the future 😊

jmalarcon avatar Jan 25 '22 15:01 jmalarcon

+1 to you also adding this to the CLI in the future! :)

tisaconundrum2 avatar Jul 06 '22 21:07 tisaconundrum2

+1

Burzyn1 avatar Sep 18 '22 15:09 Burzyn1

You're right. Thanks for the suggestion.

I don't know I I'll have the time soon to do something like that, but I keep the idea here for doing sometime in the future 😊

I'm happy to take a stab unless you'd prefer to do it?

bgrossman avatar Oct 06 '23 05:10 bgrossman

By all means, thank you. Just do a PR and I'll be happy to review and accept it. Thanks!

jmalarcon avatar Oct 06 '23 06:10 jmalarcon