Loading ...

How to determine if .NET 3.5 Framework is installed or not? | CodeAsp.Net

How to determine if .NET 3.5 Framework is installed or not?

 /5
0 (0votes)

Following is the small program to tell you whether .NET 3.5 Framework is installed or not on your machine:

using System;

namespace TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            bool hasNet35 = HasNet35();
            if (hasNet35)
            {
                Console.WriteLine(".Net 3.5 Framework is installed.");
            }
            else
            {
                Console.WriteLine(".Net 3.5 Framework is not installed.");
            }
            Console.ReadLine();
        }
        static bool HasNet35()
        {
            try
            {
                AppDomain.CurrentDomain.Load(
                    "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}


Comments (no comments yet)

Top Posts