Solved

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

Posted on 2011-02-24
6
515 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Technology Resume 7 67
Multi-Column Repeater 3 22
c#, case, if 4 17
PowerShell: ForEach-Object Export to CSV 4 34
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

761 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