Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

.net-4.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"/>

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?

like image 888
eigenein Avatar asked Sep 26 '12 23:09

eigenein


1 Answers

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"/>
like image 175
eigenein Avatar answered Nov 15 '22 09:11

eigenein