Monday, August 22, 2011

.NET Version Checker in you PC

Here's a repost of a .NET Version Checker I found in the internet.
Code:
        const string regLocation = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP";  
        static void Main(string[] args){  
        Console.WriteLine(".NET Framework versions installed");  
        Console.WriteLine("---------------------------------");  
        Console.WriteLine();  
        RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(regLocation);  
        RegistryKey tempKey;  
        if (masterKey == null)  
        {  
          Console.WriteLine("Null Key!");  
        }  
        else  
        {  
          string[] SubKeyNames = masterKey.GetSubKeyNames();  
          for (int i = 0; i < SubKeyNames.Length; i++)  
          {  
            tempKey = Registry.LocalMachine.OpenSubKey  
               (regLocation + "\\" + SubKeyNames[i]);  
            Console.Write(SubKeyNames[i]);  
            Console.WriteLine("\tVersion = {0}",   
               tempKey.GetValue("Version"));  
          }  
        }  
        Console.ReadKey();  
      }  

Reference: Check .NET Framework Version Installed

0 comments:

Post a Comment