IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Check Installed .NET Framework Version

This is a quick way to check an installed version of .NET Framework (as opposed to .NET Core). This works for any .NET Framework 4.5 or later.

We’re doing this by using a PowerShell script to get the value from the registry and a Python script to quickly match the release number to the associated .NET Framework version. This has been used so many times to get the value quickly on production servers, but use it at your own risk.

Steps

  1. On the server where you want to check the .NET Framework version, open a PowerShell window and run the following script:

    (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release
    
  2. Once you see the value, you can check it using the following Python script to see what version of .NET Framework that number corresponds to.

    #! python3
    # Check .NET version based on the release number
    # Reference https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
    
    releaseVersion = input("\nEnter .NET release number: ")
    
    def checkVersion(release):
    
        relNo = int(release)
    
        if relNo >= 528040:
            print('.NET Framework 4.8')
        elif relNo >= 461808:
            print('.NET Framework 4.7.2')
        elif relNo >= 461308:
            print('.NET Framework 4.7.1')
        elif relNo >= 460798:
            print('.NET Framework 4.7')
        elif relNo >= 394802:
            print('.NET Framework 4.6.2')
        elif relNo >= 394254:
            print('.NET Framework 4.6.1')
        elif relNo >= 393295:
            print('.NET Framework 4.6')
        elif relNo >= 379893:
            print('.NET Framework 4.5.2')
        elif relNo >= 378675:
            print('.NET Framework 4.5.1')
        elif relNo >= 378389:
            print('.NET Framework 4.5')
        else:
            print('No match')
    
    checkVersion(releaseVersion)
    

I’m sure there’s a more elegant way to do this by just running one script to do all these things but this is provided as it is.

Further Reading

How to Check Installed .NET Core Version
How to: Determine which .NET Framework versions are installed
How to Install Python on Windows Server

April 12, 2022 Filed Under: How To Tagged With: .NET, PowerShell, Python

How to Remove .NET Runtime and SDK on Mac

Check Installation

Determine which version is installed with the command line.

According to Microsoft documentation, we need to remove the SDKs and runtimes separately:

Pay attention to the difference in installed locations between the Intel Mac vs. Silicon M series chip.

Arm-based mac: /usr/local/share/dotnet/
Intel-based mac: /usr/local/share/dotnet/x64/dotnet/

In this example, I want to remove the .NET 6 RC on an M1 silicon Mac from previous test.

% dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

% dotnet --list-sdks
6.0.100-rc.1.21463.6 [/usr/local/share/dotnet/sdk]

Uninstall .NET

From the example above, we’ll remove all instances. All these commands can be entered all at once in the Terminal, it will ask you to enter sudo password just once.

sudo rm -rf /usr/local/share/dotnet/sdk/$version
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.NETCore.App/$version
sudo rm -rf /usr/local/dotnet/shared/Microsoft.AspNetCore.All/$version
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/$version
sudo rm -rf /usr/local/share/dotnet/host/fxr/$version

That’s it.

You can re-run the dotnet –list-runtimes and dotnet –list-sdks to verify that there’s no longer any .NET installed. You should see something similar to this:

% dotnet --list-runtimes                          
A fatal error occurred. The folder [/usr/local/share/dotnet/host/fxr] does not exist

% dotnet --list-sdks
A fatal error occurred. The folder [/usr/local/share/dotnet/host/fxr] does not exist

Now you can install the new version for your .NET development.

Further Reading

How to remove the .NET Runtime and SDK
How to Check Installed .NET Core Version
Trying .NET 6 Preview on macOS Silicon M1

March 15, 2022 Filed Under: How To Tagged With: .NET, macOS, Microsoft

Trying .NET 6 Preview on macOS Silicon M1

.NET 6 Banner

Installed on /usr/local/share/dotnet.

Trying to create a new F# project in Terminal.

dotnet new console --language F# -o MyFSharpApp
Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.100-preview.7.21379.14

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /Users/ITNota/Documents/Git/fsharp/MyFSharpApp/MyFSharpApp.fsproj...
  Determining projects to restore...
  Restored /Users/ITNota/Documents/Git/fsharp/MyFSharpApp/MyFSharpApp.fsproj (in 1.76 sec).
Restore succeeded.

Further Reading

If you need to uninstall the SDK when the release is out:

How to Remove .NET Runtime and SDK on Mac
Remove / Uninstall .NET SDK on macOS

August 23, 2021 Filed Under: .NET Tagged With: .NET, FSharp, macOS

How to Check Installed .NET Core Version

This is one way to determine what version of .NET Core is installed on your machine (or if it’s not installed):

  1. Launch Windows PowerShell.
  2. Runtime
    (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
    
  3. SDK
    (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
    

In the following example, you can see that .NET Core 2.1.2 Runtime is installed, but the SDK is not installed with the following error message:

dir : Cannot find path 'C:\Program Files\dotnet\sdk' because it does not exist.
At line:1 char:2
+ (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Program Files\dotnet\sdk:String) [Get-ChildItem], ItemNotFoundExcept
   ion
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
 
PS C:\Windows\system32>

PowerShell query for installed .NET Core version

Otherwise, it will look more like the next screenshot:

PowerShell query for installed .NET Core version for both Runtime and SDK

Another Way

There’s another way to accomplish the same thing with a much simpler command and this works on either Windows or macOS.

  1. Depending on your operating system, launch either Windows PowerShell or Terminal.
  2. Runtime
    dotnet --list-runtimes
    
  3. SDK
    dotnet --list-sdks
    
Installed .NET Core versions for both Runtime and SDK from PowerShell

Windows PowerShell

 

Installed .NET Core versions for both Runtime and SDK from macOS Terminal

macOS Terminal

 

When you see more than one entries, that means you have several versions installed and actually that’s the advantage of using .NET Core, you can have different versions installed side-by-side. The latest version is the last version number at the bottom of the result.

If you need a way to check the installed version of .NET Framework instead, check the link here.

Further Reading

How to Check Installed .NET Framework Version
How to determine if .NET Core is installed
How to: Determine which .NET Framework versions are installed
How to: Determine which .NET Framework security updates and hotfixes are installed
How to Remove .NET Runtime and SDK on Mac
How to Use System.Configuration.ConfigurationManager on .NET CORE

January 30, 2019 Filed Under: How To Tagged With: .NET, .NET Core, Microsoft, PowerShell, Windows

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure