Solved

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

Posted on 2011-02-24
6
516 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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