开发者

Windows Form Application convert to .Net Framework 4.0 to 2.0

开发者 https://www.devze.com 2023-03-10 14:29 出处:网络
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?

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". Fo开发者_高级运维r my C# projects, I can see the "Target Framework" property.


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.

Windows Form Application convert to .Net Framework 4.0 to 2.0

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.

Windows Form Application convert to .Net Framework 4.0 to 2.0

Select target framework:

Windows Form Application convert to .Net Framework 4.0 to 2.0


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


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!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消