Solved

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

Posted on 2011-02-24
6
513 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 70

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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 70

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 70

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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