Click here to Skip to main content
Click here to Skip to main content
Technical Blog

CLR Versions Compatibility

, 29 Aug 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Lets learn the compatibility between multiple CLR versions which exist and how can use the supportedRuntim element in an application's configuration file.

Let us try to execute application built against one version of CLR, on another CLR version, to understand forward and backward compatibility of CLR versions.

You can control the CLR version to be used for executing your application using application configuration file and supportedRuntime element, as follows:

Forward Compatibility (v1.1 to v2.0)

Let’s modify the application configuration file for CLR v1.1 application and try to execute it on CLR v2.0 and check the output.

Configuration changes:

Now executing the application, produces following:

As can be seen, CLR 1.1 applications are forward-compatible with CLR v2.0*

Forward Compatibility (v2.0 to v4.0)

Let’s modify the application configuration file for CLR v2.0 application and try to execute it on CLR v4.0 and check the output.

Configuration changes:

Now executing the application, produces following:

As can be seen, CLR 2.0 applications are forward-compatible with CLR v4.0*

Forward Compatibility (v1.1 to v4.0)

Let’s modify the application configuration file for application CLR v1.1 application and try to execute it on CLR v4.0 and check the output.

Configuration changes (basically same as we did in last step):

Now executing the application, produces following:

As can be seen, CLR 1.1 applications are forward-compatible with CLR v4.0*

Backward Compatibility (v2.0 to v1.1)

Executing CLR v2.0 application on CLR v1.1 produces following errors:

First the following message appears:

Clicking on Ok button shows the following:

And then the following exception in the command prompt:

Hence, CLR v2.0 applications are NOT backward compatible with CLR v1.1

Backward Compatibility (v4.0 to v2.0)

Similarly, while executing CLR v4.0 application on CLR v2.0, we get the following exception:

Hence, CLR v4.0 applications are NOT backward compatible with CLR v2.0

To summarize forward/backward compatibility of CLR versions:

  1. CLR v1.1 apps are forward compatible with CLR v2.0*
  2. CLR v1.1 apps are forward compatible with CLR v4.0*
  3. CLR v2.0 apps are forward compatible with CLR v4.0*
  4. CLR v2.0 and v4.0 apps are NOT backward compatible i.e. app built against a version of CLR, cannot run on the olderversion of CLR (it throws BadImageFormatException)

[*]When we talk about forward compatibility, it is important to note that the newer version of CLR would have introduced some breaking changes by modifying base class library and hence, to determine whether your application is fully compatible, you need to actually test your application on the newer CLR version before concluding on the compatibility.

Vande Mataram!

(A salute to motherland)

P.S. In addition to blogging, I use Twitter to share tips, links, etc. My Twitter handle is: @girishjjain

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Girish J Jain
Technical Lead MASTEK Ltd
India India
Girish Jain works on Microsoft .Net framework technologies and is a big fan of WPF, WCF, and LINQ technologies. When not spending time with family, Girish enjoys creating small tools, utilities, frameworks to improve developer productivity and also writes Windows Phone applications.
 
Loves economics, technology, family, and tennis. Pity liars and politicians.
Follow on   Twitter

Comments and Discussions

 
GeneralMy vote of 3 PinmemberKlaus Luedenscheidt27-Aug-12 18:43 
GeneralRe: My vote of 3 PinmemberGirish J Jain29-Aug-12 0:25 
GeneralRe: My vote of 3 PinmemberRichard Deeming5-Sep-12 9:09 
GeneralRe: My vote of 3 PinmemberGirish J Jain8-Sep-12 4:21 
GeneralMy vote of 5 PinmemberChristian Amado27-Aug-12 10:18 
GeneralRe: My vote of 5 PinmemberGirish J Jain29-Aug-12 0:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 29 Aug 2012
Article Copyright 2012 by Girish J Jain
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid