[英]How to get code library targetting .Net 4 to work with .Net 3.5 application
I'm building a new code library and would like to use .Net 4 as my target framework as all my new apps will use .net 4. My legacy web apps use .Net 3.5. 我正在构建一个新的代码库,并希望使用.Net 4作为我的目标框架,因为我的所有新应用程序都将使用.net 4.我的旧版Web应用程序使用.Net 3.5。 I want to use this code library for all of my apps.
我想将这个代码库用于我的所有应用程序。
At this point, I see only 2 options 此时,我只看到2个选项
Is there any way around this so my code library is a single compile? 有没有办法绕过这个,所以我的代码库是一个单独的编译? Didn't know if there was something built into 4 to allow something like this.
不知道4中是否有东西允许这样的东西。
Why not just build your libraries against .NET 3.5? 为什么不直接针对.NET 3.5构建库?
There are some caveats around interop and mixed-mode assemblies, but for pure-C# assemblies it shouldn't be a problem. 互操作和混合模式程序集有一些警告,但对于纯C#程序集,它应该不是问题。
It's possible to have different build configurations targeting different versions of the framework, but a bit of a pain - you'll need to mess with the project files manually. 可以针对不同版本的框架使用不同的构建配置,但有点痛苦 - 您需要手动处理项目文件。 See the project files for MiscUtil as an example.
以MiscUtil的项目文件为例。
I don't see why you were happy with the .NET 2 / .NET 3.5 situation before - it's not very significantly different to that. 我不明白为什么你对之前的.NET 2 / .NET 3.5情况感到满意 - 这与它没有太大的不同。
Of course, updating your webapps to run on .NET 4 would probably be the best solution, going forward. 当然,更新您的webapps以在.NET 4上运行可能是最好的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.