Click here to Skip to main content
14,663,669 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

While running a C# 2.0 application in VS 2010 it display an error message.

Is it possible to convert C#2.0 application to C#4.0?
Updated 7-Jul-11 21:10pm
Prerak Patel 8-Jul-11 3:01am
Did you even try?
Uday P.Singh 8-Jul-11 3:08am
post the error message!!
[no name] 8-Jul-11 3:10am
What Error it displays.
Groulien 8-Jul-11 3:19am
Did you create this project in an older version of Visual Studio? If so, it's not trying to target C#4.0 and you're asking the wrong question.

Rate this:
Please Sign up or sign in to vote.

Solution 3

When you open a solution or a project created with older versions of Visual Studio with version 2010, you will be offered to run through solution/project converter which will only modify solution and project files, automatically.

As a result of a build you may get some warning due to obsolete types/members.

As Visual Studio prior to 2008 was not multi-target, you may need to change the target Framework to v.4.0. You can select any the target Framework version, they are backward-compatible. The solution targeted for 2.0 will be readily run in the Framework 4.0 or 3.5.

[no name] 8-Jul-11 4:37am
Thank you, Ramalinga.
[no name] 8-Jul-11 8:41am
It's my Pleasure.
Tarun.K.S 8-Jul-11 4:57am
Correct. 5+
Thank you, Tarun.
Rate this:
Please Sign up or sign in to vote.

Solution 2

Just change the Target Framework from 2.0 to 4.0 in the Project Properties.
Correct, bit not 100% clear because you should have explained what happens to projects and solutions and compatibility. I voted 4 and provided additional explanations; please see my solution.
JV9999 8-Jul-11 3:48am
I do wonder why you deleted my answer which was given earlier but stated exactly the same....
Christian Graus 8-Jul-11 3:54am
There is no way of knowing who deleted your answer. Ramalinga is not an admin AFAIK.
JV9999 8-Jul-11 4:04am
According to the FAQ somebody with platinum authority should be able to delete (which he is). But let's get on topic... I shouldn't have asked it anyway...
Tarun.K.S 8-Jul-11 4:56am
Right. 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100