Running Multiple Versions of the Framework Side-by-Side

zhaozj2021-02-17  51

Early:

Side-By-Side (aka SBS, or SxS) is the phrase used to refer to the installation of two different versions of the Microsoft Windows .NET Framework on a single client or server machine. While the 1.0 version of the Framework has been patched twice, these service packs merely replace existing files in the 1.0 Framework with new ones. The v1.1 Framework is a completely separate runtime that installs on a machine with or without the v1.0 Framework present.

Adopter:

To be clear, side-by-side is not an upgrade. You can actally have one application using the v1.0 framework, and another application using the v1.1 framework, at the same time.

Early:

With no further ado, we need to introduce an occasional guest and personal friend y ours: the framework.

The framework v1.0.3705

I am v1.0.3705, or to you, the v1.0 framework. There is no c #, there is no vb, there is no c , and there is no spoon.

The framework v1.1.4322

I am v1.1.4322, or to you, the v1.1 framework. There is no c #, there is no vb, there is no c , and there is no spoon.

Early:

Adopter, We Forgot To Say That We Have Both Frameworks Here with US Today.

Adopter:

You know, They Sound Pretty Similar TO ME.

Early:

Don't let the hear you say.

While both Frameworks can exist side-by-side, there are some important considerations to take into account if you want your application to be built against a particular version of the Framework and target that version at runtime.

First, it's important to remember that each particular version of Visual Studio .NET is hard-coded to build applications against a certain Framework. Visual Studio .NET 2002 will only build applications that compile against v1.0 of the Framework. Visual Studio .NET . 2003 will only build applications that compile against v1.1 of the Framework You can deploy configuration files that let a v1.1 app run on the v1.0 Framework, but that's not the same as building against v1.0.Adopter:

SO if you need to maintain v1.0 and v1.1 Applications, You'll Need to Install Both Versions of Visual Studio. If're Also Maintaining VS 6 Applications, You'll NEED 3 VERSIONS OF VS (And About 6 GIGS) Of Disk Space.

Early:

It's somewhat unfortunate that VS 2003 can not compile against v1.0 of the Framework, but it is true that you can run VS 6, VS 2002, and VS 2003 all at the same time. It's also important to remember that if you open A vs 2002 Project In VS 2003, IT Will Be Permanently Upgraded To Vs 2003. for more details, Check Out OUR Article On What's New IN VS 2003.

Adopter:

If you read the few Microsoft documents on side-by-side, you'll see that they state an application will run against the version of the Framework that it was compiled on This is mostly true Let's take a look at the details..:

Windows Forms Applications

Application compiled against Frameworks Installed Outcome 1.0 Framework 1.0 only Runs against the 1.0 Framework 1.0 and 1.1 Runs by default against the 1.0 Framework. Can be directed to use the 1.1 Framework instead via a configuration file. 1.1 only Runs by default against the 1.1 Framework. there are no warnings that the app is running against a different version of the Framework than it was compiled against.1.1 Framework 1.0 only Fails to run, with an error, unless a configuration file is included that points to the 1.0 runtime. 1.0 and 1.1 Runs by Default Against the 1.1 framework. Can Be Directed At The 1.0 Framework Via a Configuration File. 1.1 Runs Against The 1.1 Framework.

Let's get the frameworks' Perspective On this.

The framework v1.0.3705:

I am The framework. I am without flaw.

Early:

IT Doesn't Sound Like V1.0 Is Really Evennow About this "Multiple Version" Thing. I Guess That Makes Sense. After ALL, WHEN V1.0 WAS WRITTEN, There Was Only One Version, So IT Effectively Doesn't Know That v1.1 exisss.

The framework v1.1.4322

I am the framework. Only V1.0.3705 Came Before Me. I am Everything That V1.0.3705 WAS, AND More. The Rebuilt Me, Better Than I Was Before. I am Better, Stronger, Faster, More Secure. I WILL RUN Managed Code That Was Built Against v1.1.4322. I will Also Run Managed Code That Was Built Against V1.0.3705 IF, At Runtime, V1.0.3705 IS Not Installed. I am without flaw.

Early:

Starting to Sound a Bit Like The Six Million Dollar Man Here.

Adopter:

I like it - The Six Million Dollar Framework.

Adopter:

This Is Important. If Company Compile An App Against v1.0 of the framework, but you run it on a machine That Only Has V1.1 Installed, IT Will "Just Run". You Won't get anywarnings, errors, or IT Will Just "TRY" to work.early:

You make It Sound Like this Is A Bad Thing, Even Though v1.1 is very compatible with v1.0. I Would Guess That 95% of Apps Won't just "try" to run, they will run run without a problem. What Do you recommend INSTEAD?

Adopter:

I don't think, allows, but it, but they,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 'T Seem "Trustworthy" to Run An App on A Framework That You Haven't Tested It with.

Early:

SO INSTEAD OF 5% Apps Breaking, You'D Rather Pretennd That 100% of Apps Aready Broken? What Sense Does That Make? And if you're this Worried About your v1.0 application, you can ship a config file tria Will Prevent IT from Running on V1.1 (Even Though It Would Probably Work).

Adopter:

Fine, if it's an image viewer, who cares if it "just tries to run". But what if it's an accounting package? No one knew that this would be the default behavior, and there are v1.0 applications that are already deployed. What do you do quout those? You have to ship a config file as a patch, and hope it gets installed.

ALSO, this is a real danger. Window Server 2003 Will ONLY INCLUDE The V1.1 Version of The Framework, SO IT'S QUITE POSIBLE THAT A V1.0 App Will End Up Running ON A Box with Only V1.1.

Early:

I still think you're blowing this out of proportion for a good majority of cases. If you are deploying the v1.0 Framework with your app (as you should), then when your app installs, v1.0 will also install, and Your app Will Use v1.0 at runtime, Even IF v1.1 is also there. this problem only arises if people don't take the the deploy the framework with their app.adopter:

What if you're running an application through no-touch deployment? Then you type, you're deframework, you're depending on what's already there.

Early:

I Agree That in a no-touch scenario, redirecting a v1.0 app to the v1.1 framework can be more of a problem. If you Download a configuration File with your application, though, it's not aproblem.

Adopter:

SO, FRAMEWORKS, How Compatible Are you?

The framework v1.0.3705:

I am The framework. I am without flaw.

The framework v1.1.4322

I am the Framework. I can execute your v1.0.3705 applications. The Framework v1.0.3705 contained imperfections, flaws, or as you call them "bugs". Because I contain no bugs, code that you wrote for v1.0.3705, in its Imperfection, May Perform Differently on Me, And Have a Different Behavior. Therefore, I am NOT 100% Compatible. I am, Than What Came Before. I am Without flaw.

Adopter:

The Framework brings up a good point. In the past, there were a lot of bugs that Microsoft knew about, but could not fix. I know that sounds strange, but they knew that people had coded work-arounds, and if they fixed some of the bugs, they would actually break a lot of people's code. Now, Microsoft is free to fix any bugs in subsequent versions of the Framework, because you're always free to continue running on the Framework that you compiled against. If you Have a v1.0 Application, IT CAN Continue To Run on the v1.0 framework until the end of time (Which Probably Means 5-10 Years In Computer Terms) .serly:

I Guess We'd Have To Look Into a Crystal Ball To Figure If this Is Really Going to Be a Problem. Just Be Aware What if You Run A V1.0 Application ON A Box That Only Contains V1.1, IT Will QuietLe Try to Run. I Think In Most Cases, IT Will Work Fine, But if this WORRIES you, THEN START SHIPPING CONFIG Files with your v1.0 Applications Today. Also, Don't think this v1.1 Will Be The Last Framework Ever Released. You Should Consider Shipping a confz so what the the.....

Errors raised

What if You Go The Other Direction, And Try To Run A V1.1 Application ON A Machine That Only Contains v1.0? By Default It Won't Run. INSTEAD, EXPECT The FOLLOWING:

Notice That It is not the friendliest message. It would be nice if you at Would Be Nice, and and where to go download it, but such is not the case.

Configuration Files

If you want to change the Framework that an application will run against, it is quite easy to create the appropriate configuration files using Visual Studio .NET 2003. To create configuration files, you go to the Build option in the Properties view for a project. This option can be accessed simply by right-clicking your project in the Solution Explorer and choosing Properties: It's also good to note that the configuration files generated by VS 2003 can be used with a v1.0 or v1.1 application, so for the scenario that Adopter was pointing out earlier (pointing out = ranting about J), where you want to insure that a v1.0 application will only run against the v1.0 Framework, you use VS 2003 to generate the following configuration file:

Configuration File Targeting v1.0 ONLY:

Appliesto = "v1.0.3705">

PublickeyToken = "b03f5f7f11d50a3a" culture = "neutral" />

Newversion = "1.0.3300.0" />

Culture = "neutral" />

NEWVERSION = "7.0.3300.0" />

... (a lot more of these binding redirects) ...

Notice All The tags. This section information is used to tell a v1.0 Application Only To Run on the v1.0 framework.

To tell a v1.1 application which version of the Framework to use, it's a lot easier. You simply place the information in the section. This is possible because of a feature known as "unification." For an explanation of unification The Framework CAN Probably Describe it beg.

The framework v1.0.3705:

An UnhandLled Exception of Type 'question.undefinedException' Occurred in Unification.question. 'Unification' is not defined.

The Framework v1.1.4322:

Unification is a concept that did not exist with v1.0.3705 of the framework. Because unification Did Not Exist, Your Application Was Required To Individually Bind To Each Assembly That Was Part of v1.0.3705.

I (v1.1.4322) support unification. This means that I am considered a single atomic unit, even though I contain many assemblies. As a result, I can simply be referred to as v1.1.4322, as shown in the tag IT IS Not Necessary to Bind to Each of My Assembly INDIVIDUALLY.

I am Also Unique. You Cannot Create Your OWN Collection of Assembly And Unify The So That They Are VersionAble As a Unit. For Collections of Assemblies That You Create, You Must Bind to Each Individually.

Adopter:

You can also generate a configuration file that states your application is compatible with either v1.0 or v1.1 of the Framework. Look at the section of the following file. This file says that a minimum of v1.0 is required , But Either v1.0 or v1.1 Will Work.configuration File Targeting V1.1 and v1.0:

Appliesto = "v1.0.3705">

PublickeyToken = "b03f5f7f11d50a3a" culture = "neutral" />

Newversion = "1.0.3300.0" />

Early:

Components

I will not bother with a table when it comes to components and the choices you have for them, because simply put, you do not have any. Components are simply dragged along to run against whatever version of the Framework the application wants to run Against. To Understand this better, Let's Look at a scenario.

You as a component vendor have tested and developed a component against the v1.0 Framework. It is now deployed and running in some of your customer's v1.0 Windows applications. If your customer takes their application and your associated component, and moves it to A Machine That Only Has The V1.1 Framework, The Application Will "Just Run" on v1.1, and your component the v1.1 framework. an Application IS Either Running on v1.0, or v1 .1. There's no way to have an application using Both v1.0 and v1.1 simultaneously.adopter:

This works both ways. If you've built a v1.1 component, there's nothing to prevent a developer from referencing it from a v1.0 application. In this case, your v1.1 component finds itself running on the v1.0 Framework ........................ ..

ASP.NET

This situation for ASP.NET is (IMHO) really bad. When you install v1.1 of the Framework, by default, it will upgrade all the web sites to v1.1. Done inadvertently, this could have serious implications. This is especially important if you are deploying the Framework with your application (which is a good idea). In this case, it's essential that you do not upgrade all the web sites, as this would be completely unexpected behavior. The correct way to install the Framework, WITHOUT UPGRADING Web Sites, IS To Use the Following Command:

DotNetfx.exe / Q: A / C: "Install / noaspupgrade / l / q"

This Will Perform A Quiet Install And Will Leave The ASP.NET SITES Alone.

Early:

When you install Visual Studio .NET 2003, it will install the Framework in such a way that all the sites are upgraded. If you still want some sites to run against v1.0 of the Framework, you can redirect a site back using the following Steps: Open the Visual Studio .NET 2002 Command Prompt.

Execute The Following Command:

ASPNET_REGIIS -S W3SVC / 1 / Root / MyWebApp

THIS WILL RE-POINT The Web App to v1.0 of the framework. If you wanted to do the reverse (Manually Point A V1.0 Web App AT V1.1), You Would SIMPLY Open The Visual Studio .NET 2003 Command PROMPT And Run The Same Command. Remember, Each Version of the Framework Carries ITS OWN Complete Copy of The Framework Assemblies, Command Line Tools, Compilers, ETC.

CONFIGURATION

It's also important to note that if you have both v1.0 and v1.1 installed, you will have two separate versions of the .NET Configuration Utility. Changes that you make to permission sets or code groups are version specific.

Adopter:

Summary

To Review, Here Area Some Key Things To Keep In Mind About Side-by-Side:

Deploy the Framework with your app. This is the single most important thing you can do to insure that you do not have to deal with Framework version issues. Also, when you deploy the Framework with an application, do not upgrade ASP.NET Web site.

1.0 applications will run on the 1.1 Framework if no configuration file is present to prevent them from doing so. A 1.1 application will fail to execute on a machine with only the 1.0 Framework installed if no configuration file is present to allow it to do so. Components have no life of their own and run against whatever version of the Framework the associated application runs against. It is not possible to have different components within a single application run against different versions of the Framework. Configuration files can be created by the tools found in Visual Studio .NET 2003. These configuration files can give explicit instructions for how your application should behave in the presence of v1.0, v1.1, or both.Finally, I strongly recommend that you test your applications on v1.1 of The Framework Truly Is More Reliable and Secure Than V1.0. Once It Releases, There's No Reason Why Your Applications Shouldn't Leverage IT.

Frameworks, ANY Final Thoughts?

The framework v1.0.3705:

I am The framework. I am without flaw.

The framework v1.1.4322

I am The framework. I am without flaw.

3 Leaf Solutions provides training, consulting, mentoring, and content development services to early adopters of Microsoft technologies. If you have any questions about 3 Leaf, or comments regarding this article, please do not hesitate to contact Early or Adopter.

You can Find More from Early & Adopter in Their Weblog, or Go To The List of 3Leaf Articles.