简体   繁体   中英

Changing Target Framework from .NET 3.5 to .NET 4.0

I have a C# class library project which defines some windows forms controls. This library targets .NET 3.5 and is called from a C++/CLI windows forms project which targets .NET 4.0. I would like to avoid having my application loading/requiring multiple .NET runtimes. Is it safe if I simply changed the target framework of the class library to .NET 4.0? Are there any other changes I need to make? What incompatibilities (if any) exist when moving from .NET 3.5 to .NET 4.0?

There are no other clients using the windows forms library except for the windows forms application I mentioned.

I found this page on MSDN, which seems to highlight some migration issues.

http://msdn.microsoft.com/en-us/library/vstudio/ee941656%28v=vs.100%29.aspx

If your C# library depends on third party components, you may want to also review what framework dependencies they may have.

If you do not have any framework restrictions from researching the above, it should be relatively safe to just change the target version of the framework in the Application section of the Project Settings. If you do not receive any compile errors, you should just test your application to verify how it responds.

As Windows Forms hasn't changed all that much since 3.5 I'm pretty certain you're not going to encounter any issues, such as breaking API issues, it should just be a simple recompile.

Even if you're referencing libraries which use an older version of the .NET framework it will still work due to Side-by-Side execution . But even still if possible I would update the third party libraries for releases for .NET 4.0

I would also add that .NET 4 Winforms applications can reference.NET 3.5 class libraries again using side-by-side execution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM