Click here to Skip to main content
13,453,523 members (49,448 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 13 Apr 2010

Running .NET 1.1 Applications on .NET 2.0

, 13 Apr 2010
Rate this:
Please Sign up or sign in to vote.
Running .NET 1.1 Applications on .NET 2.0

One of the applications I developed is a .NET 1.1 Windows Forms application used by more than 5000 users and is critical for the business.

Being a complex and critical application, porting it to the 2.0 runtime just because it was not an option, it would mean installing the new runtime and framework on the stable environment of the workstations (Windows XP) and fully test the application. That was not an option.

As time went by, a developer received a brand new laptop with Windows Vista. Since he only needed .NET 2.0 for his developments, he never installed .NET 1.1.

Another developer on my team had already tried to port the application to .NET 2.0 and run into some issues:

  • The main component of this application is the Web Browser Control. This control derives from AxHost, which changed going from 1.1 to 2.0 and needed major changes to compile for the 2.0 framework.
  • Another change was that mixing synchronous and asynchronous calls is not allowed in the 2.0 framework and we had, at least, one of those in our use of HttpWebRequest/HttpWebResponse.

The .NET 2.0 runtime and frameworks were developed to be highly compatible with applications written and compiled to the 1.1 runtime and frameworks. In fact, some of the changes were just applying the ObsoleteAttribute set to throw a compiler error when used, which doesn't prevent its use by already compiled assemblies. This was the case of the WebBrowserControl/AxHost and just using the assembly compiled for .NET 1.1 would probably run fine. And it did.

The synchronous/asynchronous was also very easy to fix. All it took was changing this:


into this:

request.EndGetRequestStream(response.BeginGetRequestStream(null, null))

And it all worked as if it was running on .NET 1.1.

But that’s not the end of it. Later came a requirement to use, in one of the web pages that ran in the web browser control, an ActiveX component developed in .NET 2.0.

But that time, the 2.0 runtime and framework were already installed on the workstations.

How would we force the application to run in the 2.0 runtime if the 1.1 runtime was still there?

It was as simple as adding this to the configuration file (App.config):

    <requiredRuntime version="v2.0.50727" safemode="true"/>


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


About the Author

Paulo Morgado
Software Developer (Senior) Paulo Morgado
Portugal Portugal

You may also be interested in...


Comments and Discussions

QuestionDoubt about changing version Pin
chisclas4-Apr-11 20:56
memberchisclas4-Apr-11 20:56 
AnswerRe: Doubt about changing version Pin
Paulo Morgado5-Apr-11 14:13
memberPaulo Morgado5-Apr-11 14:13 
GeneralRe: Doubt about changing version Pin
chisclas5-Apr-11 20:30
memberchisclas5-Apr-11 20:30 
GeneralRe: Doubt about changing version Pin
Paulo Morgado5-Apr-11 23:23
memberPaulo Morgado5-Apr-11 23:23 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03-2016 | 2.8.180318.3 | Last Updated 13 Apr 2010
Article Copyright 2010 by Paulo Morgado
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid