7
votes

While creating a Windows Form Application, I selected target to .Net Framework 4.0. Now I would like to build it to .Net Framework 2.0. How can I do it using Visual Studio 2010?

It is a VB.Net project. I could not see "Target Framework". For my C# projects, I can see the "Target Framework" property.

4

4 Answers

16
votes

For C# project, if you go to the project properties, you will find Target Framework on Application tab. Switch it to .NET Framework 2.0.

enter image description here

Try to build and remove unsupported namespaces.

If you used any features specific to .NET 4, you will have to fix it manually.

[Edit] As you mentioned that you use VB.NET.

For VB.NET go to project properties, hit Advanced Compile Options... to the Compile tab.

enter image description here

Select target framework:

enter image description here

2
votes

Right click the project in Solution Explorer and go to properties change the Target framework in the Application tab.

0
votes

In my experience after switching the target framework, the core references will not be updated.

For example I changed from C# library 4.0 back to 3.5 (so I could work it with SP2010), and found it left CSharp.exe (a 4.0 assembly) as an undefined reference.

I recreated it from scratch and found the set of core references is different.

To be safe, I would recommend recreating your project and re-adding the project files after.

But who knows, you may get lucky. :D Good luck!

0
votes

i've been try to upgrade my project from .net 2.0 to 4.0, and yeah the reference is still targeting .net 2.0. The solution open *.csproj (project file) with notepad, and change

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="2.0">

into

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

Hope this help