如何强制在.NET 4.5运行.NET 3.5应用程序运行? [英] How to force .NET 3.5 application run on .NET 4.5 runtime?
问题描述
我想实现在此描述的解决方案:<一href="http://stackoverflow.com/questions/6119614/can-i-use-a-net-4-feature-while-targeting-net-3-5-sp1/6134742#6134742">Can我使用的是.NET 4的功能,同时针对.NET 3.5 SP1?。它工作正常,当.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 4.5运行.NET 3.5应用程序运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!