Getting installed .NET Framework versions is (surprisingly) not a simple task.
On this post, let's try to address that.
When .NET developers have to fix problems on a remote server that requires
knowing which versions of the .NET Framework are installed, they'll be
frustrated. Unfortunately, the
Redmond folks made it
unnecessarily complicated to know the installed versions of the .NET Framework
on a Windows box.
Listing the installed folders
The simplest and fastest solution is obviously listing the contents of the folders .NETFramework folder with:
dir "C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\.NETFramework"
While that's usually sufficient to list what's installed, it does not confirm
IF the frameworks are correctly registered in the system.
To confirm that everything's correctly setup we'll have to use PowerShell as described next.
Listing the frameworks using PowerShell
To list which frameworks are installed directly from the Windows Registry can be found on this PowerShell script:Simplifying Further
Ok, but let's assume that we're on a remote server. Opening chrome and downloading this script might not be ideal. Could we somehow script this out? Yes, by using PowerShell's Invoke-WebRequest (PowerShell's curl), we could make it a one-liner so that we don't have to even open a browser and download that script from GitHub. Here is it:
Invoke-WebRequest -Uri
https://github.com/hd9/powershell/raw/master/list-dotnet-frameworks.ps1
-OutFile list-dotnet-frameworks.ps1; .\list-dotnet-frameworks.ps1
Hope it helps!See Also
- My journey to 1 million articles read
- PowerShell - The server committed a protocol violation
- Getting last modified software on Windows using PowerShell
- Creating ASP.NET Core websites with Docker
- Send emails from ASP.NET Core websites using SendGrid and Azure
- Configuration in .NET Core console applications
- Countdown to .NET 5.0
- Creating a Ubuntu Desktop instance on Azure
- Package Management in .NET Core
- Building and Running ASP.NET Core apps on Linux
- Why I use Fedora Linux
- Windows Subsystem for Linux, the best way to learn Linux on Windows
- How I fell in love with i3