How To Ideas | How To Articles | How To Tutorials


0

How To Determine Which .NET Framework Version Is Installed


This is a general question which people ask when they try to run an application build in the newer version of .NET Framework than the .NET Framework they currently have in their Computer. So here is a small trick you can use to find all the .NET Versions listed which are currently installed in your Computer.

Instructions:

  1. Using Registry
    • Open your Registry Editor by typing regedit in Start menu search box.
    • In the Registry Editor Move to the following location
      HKEY_LOCAL_MACHINE–>SOFTWARE–>MICROSOFT->.NETFRAMEWORK
    • This Key in Registry Editor has a number of folders listed, one each for every .NET Framework version you have installed in your Computer.
    • If your Registry Editor does not have the above Location, then try the following location
      HKEY_LOCAL_MACHINE–>SOFTWARE–>MICROSOFT->NET FRAMEWORK SETUP/NDP
      image
  2. Using Visual Studio Command Prompt
    • If you have installed the latest .NET Framework, then you can find a Visual Studio Command Prompt, which is available from the Visual Studio Tools folder which can be used to compile our Code files.
    • You can find the Visual Studio Command Prompt in the following directory
      • For .NET Framework 4.0 or Later
        Start –> All Programs –> Microsoft Visual Studio –> Visual Studio Tools, and then click Visual Studio Command Prompt
      • For Earlier Version Of .NET Framework
        Start –> All Programs –> Microsoft Visual Studio –> Visual Studio Tools, and then click Visual Studio Command Prompt. (Only if you have Visual Studio 2005 or later is installed)
        or
        Start –> All Programs –> Microsoft .NET Framework SDK v2.0, and then click SDK Command Prompt. (Only if you have .NET Framework 2.0 or higher is installed)
    • If we just type csc in that Visual Studio Command Prompt and hit Enter, It will give an error and also tell us about the Latest .NET Framework installed in the machine.
      image
  3. Using C# Code
    • You don’t need to have Visual Studio installed too use this method. Just open any text editor like Notepad and add the following code in it.

      using System;
      class Version
      {
           public static void Main()
           {
                 Console.WriteLine(); 
                 Console.WriteLine("Latest .Net Framework Version is {0}", Environment.Version.ToString());
           }
      }

    • Now save this file with the any name but extension must be “.cs” and you must select “All Files” in the “Save As Type:” box while saving the file. I am saving this file with the name “Framework.cs” in D:\ directory.
      image
    • Now open the Visual Studio Command Prompt which I had described in the 2nd method.
    • Move to the directory where you have saved the file, in my case, it is in D:\ directory.
    • Type the following command in there and hit Enter, It will compile your file and make a .exe file from it.
      csc Framework.cs
    • It might give you a warning but don’t worry it will compile your file correctly.
    • Now type just Framework.exe there and hit Enter. It will show you the Framework Version as output of the program.
      image

Incoming search terms:

  • determine net version (1)
  • find net framework in registry c# (1)
Filed in: C#, Windows Tags: , , , , , , , , , ,

Leave a Reply

Submit Comment



© 5960 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.