Demystifying Assembly Binding – Why only .NET 3.0 depends on a previous version of .NET (2.0) to be installed

I was asked is whether .NET 2.0 depends on .NET 1.1 (or 1.0) to be installed. The answer to this is, no.
 
The only .NET version that is dependant on a previous version is .NET 3.0 (requires .NET 2.0 to be installed). The reason for this is that .NET 3.0 does not install replacement assemblies for existing assemblies. It’s just .NET 2.0 with extensions to support the four pillars of .NET 3.0 – Windows Communication Foundation (WCF), Windows Workflow WF, Cardspace, and Windows Presentation Foudnation (WPF).
 
Okay… show me:
If you have .NET 1.1 and 2.0 installed (or 1.0 and 3.0 if you want to take this all the way to the end), you can see the replacement assembly versions listed in the Global Assembly Cache (GAC) (Start > Run > %WINDIR%Assembly).
 
In the GAC you will notice that there is a System (for example) assembly listed there for each of .NET 1.1 (version 1.0.5000) and 2.0 (version 2.0.0.0). If you have .NET 3.0, you’ll notice that the replacement assembly doesn’t exist but, if you look for System.ServiceModel (one of the assemblies installed by .NET 3.0), the assembly exists with version 3.0.0.0.
 
The next question I was asked was "Then how does the framework know which assembly to bind to?" Thankfully, I could refer this question to a fundamental .NET reference on MSDN, How the Runtime Locates Assemblies. This is a great article that explains how the .NET framework loads up and binds your assemblies to dependant assemblies and how you can specify what version (likley needed if you are using a deprecated assembly that is installed in the GAC) of an assembly you need to use for your application.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s