简体   繁体   English

如何强制.NET 3.5应用程序在.NET 4.5运行时运行?

[英]How to force .NET 3.5 application run on .NET 4.5 runtime?

I'm trying to implement the solution described here: Can I use a .NET 4 feature while targeting .NET 3.5 SP1? 我正在尝试实现此处描述的解决方案: 我可以在面向.NET 3.5 SP1时使用.NET 4功能吗? . It works fine when a .NET 3.5 application runs on .NET 4.0. 当.NET 3.5应用程序在.NET 4.0上运行时,它可以正常工作。 However, on .NET 4.5 the app runs on .NET 3.5 environment. 但是,在.NET 4.5上,该应用程序在.NET 3.5环境中运行。 I have tried the following: 我尝试过以下方法:

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>

with no success. 没有成功。 Environment.Version still tells 2.0.50727.5456 while on .NET 4.0 everything is OK. Environment.Version仍然告诉2.0.50727.5456而在.NET 4.0上一切正常。

Is there a way to force .NET 3.5 app use .NET 4.5 if available? 有没有办法强制.NET 3.5应用程序使用.NET 4.5(如果可用)?

It's my fault: app.config accidentally was not copied onto build directory. 这是我的错:app.config意外没有复制到构建目录。 Everything works with: 一切都适用:

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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