Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Target .net 4.5 but deploy to .net 4.0 is it possible?

I have to work under the following policy "all software must be 1 version behind", I don't particularly like this and I cant change it. so that would mean that our production machine will only go as far as .NET 4.0 for now, only when .NET 5 is release can we move to 4.5! silly, I know.

so currently I am planning on proposing for dev machines to upgrade to Visual studio 2012 and target .NET 4.0 which is ok for now;

We have some projects in the immediate future which would need a lot of asynchronous programming and I want to be able to use all the 4.5 syntactic goodness the async/await and all the rest of the improvements.

so what are the options! accept "thats just life" and only target 4.0 and moan! or is there a way to target 4.5 in dev and import some 4.5 dll's into prod, is this even possible? ultimately is it possible to develop to take advantage of the 4.5 features in any way and deploy to 4.0? any advice please...

like image 425
Ricky Gummadi Avatar asked Sep 28 '12 03:09

Ricky Gummadi


People also ask

Is .NET 4.5 backwards compatible?

NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework. In other words, apps and components built with previous versions will work without modification on the . NET Framework 4.5 and later versions.

Can multiple versions of .NET be installed?

Microsoft designed the . NET Framework so that multiple versions of the framework can be installed and used at the same time. This means that there will be no conflict if multiple applications install different versions of the . NET framework on a single computer.


2 Answers

You're looking for Microsoft.Bcl.Async.

like image 196
SLaks Avatar answered Sep 22 '22 22:09

SLaks


Note that it's not supported to create .NET4.5 app and then attempt to re-target it for .NET4.0. Basically, when you build app with .NET4.5, you may be using new APIs that got added in 4.5 and are not present in 4.0. So your app will not work correctly.

like image 45
Varun Avatar answered Sep 19 '22 22:09

Varun