[英]Changing Target Framework from .NET 3.5 to .NET 4.0
I have a C# class library project which defines some windows forms controls. 我有一个C#类库项目,该项目定义了一些Windows窗体控件。 This library targets .NET 3.5 and is called from a C++/CLI windows forms project which targets .NET 4.0.
该库针对.NET 3.5,并从针对.NET 4.0的C ++ / CLI Windows窗体项目中调用。 I would like to avoid having my application loading/requiring multiple .NET runtimes.
我想避免让我的应用程序加载/需要多个.NET运行时。 Is it safe if I simply changed the target framework of the class library to .NET 4.0?
如果仅将类库的目标框架更改为.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?
从.NET 3.5迁移到.NET 4.0时,存在哪些不兼容性(如果有)?
There are no other clients using the windows forms library except for the windows forms application I mentioned. 除了我提到的Windows窗体应用程序之外,没有其他客户端使用Windows窗体库。
I found this page on MSDN, which seems to highlight some migration issues. 我在MSDN上找到了此页面,该页面似乎突出了一些迁移问题。
http://msdn.microsoft.com/en-us/library/vstudio/ee941656%28v=vs.100%29.aspx 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. 如果您的C#库依赖于第三方组件,则可能还需要查看它们可能具有的框架依赖项。
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. 由于Windows Forms自3.5以来没有发生太大变化,我可以肯定地说您不会遇到任何问题,例如中断API问题,因此它应该只是一个简单的重新编译。
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 . 即使您引用的库使用的是.NET框架的较早版本,由于并排执行,它仍然可以使用。 But even still if possible I would update the third party libraries for releases for .NET 4.0
但是,即使有可能,我仍将为.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. 我还要补充一点,.NET 4 Winforms应用程序可以使用并行执行再次引用.NET 3.5类库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.