简体   繁体   中英

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? . 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"/>

with no success. Environment.Version still tells 2.0.50727.5456 while on .NET 4.0 everything is OK.

Is there a way to force .NET 3.5 app use .NET 4.5 if available?

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"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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