Solved

how can i find the .net framework version in my windows xp ???

Posted on 2011-02-24
6
509 Views
Last Modified: 2012-05-11
currently i am working on C#.net windows application ...

i want to know that how can i find the current .net framework version in my windows xp ???

is there any command for that ??
0
Comment
Question by:Parth48
6 Comments
 
LVL 14

Expert Comment

by:quizwedge
ID: 34969124
0
 
LVL 13

Expert Comment

by:agarwalrahul
ID: 34969147
Go to the Control Panel-> Click on Add Remove Programs-> Check Microsoft .Net Framework version or go to the Framework Folder, Path=C:\WINDOWS\Microsoft.NET\Framework, their are separate folder for each .Net Framework.

Like: You Find v1.0.3705, v1.1.4322, v2.0.50727 means you have upto .Net Framework 2.0.
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 34969553
I have this code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {

        private const string FRAMEWORK_PATH = "\\Microsoft.NET\\Framework";
        private const string WINDIR1 = "windir";
        private const string WINDIR2 = "SystemRoot";

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(AllFrameworkVersions);
        }

        public string WindowsPath
        {
            get
            {
                string strWinDir = Environment.GetEnvironmentVariable(WINDIR1);
                if (string.IsNullOrEmpty(strWinDir))
                {
                    strWinDir = Environment.GetEnvironmentVariable(WINDIR2);
                }

                return strWinDir;
            }
        }

        public string NetFrameworkInstallationPath
        {
            get { return WindowsPath + FRAMEWORK_PATH; }
        }

        public string AllFrameworkVersions
        {
            get
            {
                string strInfo = string.Empty;
                string strVersion = "Unknown";

                foreach (string strX in Directory.GetDirectories(NetFrameworkInstallationPath, "v*"))
                {
                    strVersion = ExtractVersion(strX);
                    if (PatternIsVersion(strVersion))
                    {
                        if (!string.IsNullOrEmpty(strInfo))
                            strInfo += ", ";
                        strInfo += strVersion;
                    }
                }

                return strInfo;
            }
        }

        private string ExtractVersion(string pdirectory)
        {
            int intStartIndex = pdirectory.LastIndexOf("\\") + 2;
            return pdirectory.Substring(intStartIndex, pdirectory.Length - intStartIndex);
        }

        private bool PatternIsVersion(string pVersion)
        {
            return new Regex("[0-9](.[0-9]){0,3}").IsMatch(pVersion);
        }


    }
}

Open in new window

0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Parth48
ID: 34977344
Thanks @emoreau:

it's worked...

i have to use only .net framework V4.0 , then what can i do ??

is there any setting in visual studio 2008 ??
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 34978436
Visual Studio 2008 cannot target .net framework 4.0 (only VS2010 can).

VS2008 can target 2.0, 3.0 or 3.5.

You have to either install .net frameork 2.0 and 3.5 to continue using VS2008 or use VS2010.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 34978469
Apparently you have created a new question (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_26847072.html) to contiue to work on this.

Since I have answered this question (how can i find the .net framework version in my windows xp), can you close this one?
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now