如何强制 .NET 3.5 应用程序在 .NET 4.5 运行时上运行? [英] How to force .NET 3.5 application run on .NET 4.5 runtime?
问题描述
我正在尝试实施此处描述的解决方案:我可以在面向 .NET 3.5 SP1 的同时使用 .NET 4 功能吗?.当 .NET 3.5 应用程序在 .NET 4.0 上运行时,它工作正常.但是,在 .NET 4.5 上,应用程序在 .NET 3.5 环境中运行.我尝试了以下方法:
I'm trying to implement the solution described here: Can I use a .NET 4 feature while targeting .NET 3.5 SP1?. It works fine when a .NET 3.5 application runs on .NET 4.0. However, on .NET 4.5 the app runs on .NET 3.5 environment. I have tried the following:
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
没有成功.Environment.Version
仍然告诉 2.0.50727.5456
而在 .NET 4.0 上一切正常.
with no success. Environment.Version
still tells 2.0.50727.5456
while on .NET 4.0 everything is OK.
有没有办法强制 .NET 3.5 应用程序使用 .NET 4.5(如果可用)?
Is there a way to force .NET 3.5 app use .NET 4.5 if available?
推荐答案
这是我的错:app.config 不小心没有复制到构建目录中.一切都适用于:
It's my fault: app.config accidentally was not copied onto build directory. Everything works with:
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
这篇关于如何强制 .NET 3.5 应用程序在 .NET 4.5 运行时上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!