Monday, January 20, 2020

How to list installed .NET Framework versions using PowerShell

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.

.NET Core on the other side, does it well via the .NET Core CLI. But for those of us still on the .NET Framework, what can we do? The official documentation, describes multiple options including accessing the registry, using PowerShell and building a C# application.

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 -OutFile list-dotnet-frameworks.ps1; .\list-dotnet-frameworks.ps1
Hope it helps!

See Also

For more posts on .NET Core, please click here.

Monday, January 6, 2020

Countdown to .NET 5

2020 is an excellent year for .NET. This is the year we'll finally see .NET 5 merging .NET Core, .NET Framework and Xamarin.
2020 brings great news for .NET developers. This is the year that, Microsoft expects to consolidate .NET Core and .NET Framework on a single platform called .NET 5 including .NET mobile (Xamarin), ASP.NET Core, Entity Framework Core, WinForms, WPF and ML.NET.. The first preview is expected in the first half of the year with the official release foretasted for Nov, 2020. Excited? You should be!

Update: The first beta release is available now!

Great news for .NET developers

That's great news for folks working on .NET Core since there'll be an influx of projects to work, contribute and develop. But that's even better news for teams working on slow-moving projects (aka, most of us) which have been deferring an update to the more modern, faster and container-friendly .NET Core.

I posted some time ago my insights regarding this update. TLDR, I'm super excited! Being a long time Fedora Linux user and a big open source enthusiast, I have been using .NET Core for my personal projects on Linux (and running them successfully on both Docker, AWS and Azure). While I'm transitioning more and more my workflow to open source software (such as Vim, i3, etc) and and have been working a decent portion of my time with Go and Python, .NET is still my default framework.

So let's take another look at what's coming up next with .NET.

Highlights of .NET 5

Apart from the single codebase, my preferred highlights of .NET 5 are:
  • .NET will become a single platform including Xamarin, ASP.NET Core, Entity Framework Core, WinForms, WPF and ML.NET
  • Unified .NET SDK experience:
    • Single BCL (Base Class Library) across all .NET 5 applications. Today Xamarin applications use the Mono BCL but will move to use the.NET Core BCL, improving compatibility across our application models.
    • Mobile development (Xamarin) is integrated into .NET 5. This means the .NET SDK will support mobile. For example, you can use “dotnet new XamarinForms” to create a mobile application.
  • Native Applications supporting multiple platforms: Single Device project that supports an application that can work across multiple devices for example Window Desktop, Microsoft Duo (Android), and iOS using the native controls supported on those platforms.
  • Cloud Native Applications: High performance, single file (.exe) <50MB microservices and support for building multiple project (API, web front ends, containers) both locally and in the cloud.
  • Open source and hosted on GitHub
  • Cross-platform and better performance
  • Decent command-line interface (CLI)
  • Java, Objective-C and Swift interoperability
  • Support of static compilation of .NET (ahead-of-time – AOT)
  • Smaller footprints

A Unified Platform

This is a more holistic view of what .NET 5 will be:

The Schedule

The proposed merge is expected to happen by November 2020. Here's the plan:
You can also check the release status in real time on GitHub (Jan, 2020):

What's Next

So what's next? Well, the best thing to do is to keep an eye on .NET's official blog as they'll be updating the status of the project through there. Would you like to contribute? Jump into .NET Core and CoreFx repositories in GitHub. For more information on the topic, consider reading .NET Core and .NET merging as .NET 5.0.


See Also

For more posts on .NET Core, please click here.

About the Author

Bruno Hildenbrand      
Principal Architect, HildenCo Solutions.