Geeks With Blogs

Soppa Group India
iSmart Panache Inc
R Systems Internationals Ltd
Technovate eSolutions Pvt Ltd
The contents of this blog are my personal opinion and do not represent in any way the view of my employer.
These postings are provided "AS IS" with no warranties, and confer no rights.

Google PR™ - Post your Page Rank with

Narendra Tiwari

1. Create 2 shared assemblies with different versions ( and

2. For assembly 1 include the following reference in project file.
    <Reference Include="TestAssembly, Version=, Culture=neutral, PublicKeyToken=508b5c5f7455410a, processorArchitecture=MSIL">

Hint Path Vs Reference Path
As for the "Referece Path" or "Hint Path" in the VS.NET project's setting
files, they're all design-time /dev-time setting used by the IDE. As
described in the IDE's help doc, "Reference Path" are used by the VS.NET
IDE to load all the assembliy references when the Project is loaded into
the VS.NET IDE. And the "Hit Path" is mainly used for building time, when
the IDE will build the project, it'll locate the assemblies which is
required to link through the "Hint Path". Anyway, they're all internally
used by the VS.NET IDE, and is possibly to change in sequential version and
they have nothing to do with the .NET framework CLR's runtime assembly

For .net framework CLR's runtime assembly locating, it'll follow a well
defined steps, generally, it'll check GAC (if strong-named) first, then,
codebase settting , and private path probing. Here is a MSDN reference
which describing the .NET framework's runtime assembly locating.

3. Form assembly 2 include the following reference in the project file.
    <Reference Include="TestAssembly, Version=, Culture=neutral, PublicKeyToken=275b13b4e9b16f25, processorArchitecture=MSIL">

4. While refering the above assemblies set extern aliases for both the assemblies
      extern alias Test1;
      extern alias Test2;

5. And then we can use Test1 and Test2 as 2 different namespaces

TestClass t1 = new Test1.TestAssembly.TestClass();
      MessageBox.Show(t1.Add(2, 3).ToString());

      Test2.TestAssembly.TestClass t2 = new Test2.TestAssembly.TestClass();
      MessageBox.Show(t2.Add(2, 3, 4).ToString());

Please note the project referencing both the assemblies will be compiled with the following warnings.

Warning 1 
No way to resolve conflict between "TestAssembly, Version=, Culture=neutral, PublicKeyToken=275b13b4e9b16f25" and "TestAssembly, Version=, Culture=neutral, PublicKeyToken=508b5c5f7455410a". Choosing "TestAssembly, Version=, Culture=neutral, PublicKeyToken=275b13b4e9b16f25" arbitrarily. WindowsApplication1

Warning 2 
The referenced component 'TestAssembly' could not be found.

Above scenario is about when we refer both the assemblies of (same name different versions) in the same code file ..but what if we want to override the functionality of an assembly ver 1.0 with ver 2.0.

put following <runtime> tag under configuration settings in the aplication's config file.

assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
assemblyIdentity name="<assemblyName>" publicKeyToken="<publicKeyToken>" culture="<culture>" />
<!--<assemblyIdentity name="TestAssembly" publicKeyToken="5ce1b9763dbb3e84" culture="neutral" />->
bindingRedirect oldVersion="<oldVersion>" newVersion="<newVersion>" />
<!--<bindingRedirect oldVersion="" newVersion="" />-->

Posted on Tuesday, November 11, 2008 9:38 AM .Net | Back to top

Comments on this post: How to use multiple versions of assembly

# re: How to use multiple versions of assembly
Requesting Gravatar...
it's good post but I tried with VS 2010 and didn't work for me. it takes only one .dll at a time and so I can't even create second alias. any idea?
Left by Ash on Feb 02, 2012 3:31 AM

# re: How to use multiple versions of assembly
Requesting Gravatar...
thanks for the post. I'v tried it with VSS 2010 and VSS 2008. It didn't work. Could you please provide a sample zip.

Left by Manifredo on Apr 11, 2012 4:39 PM

Your comment:
 (will show your gravatar)

Copyright © Narendra Tiwari | Powered by: