Side by Side execution

Topics: General discussion
Sep 2, 2009 at 9:28 PM
Edited Sep 2, 2009 at 9:38 PM

How does one enable side by side execution of the Microsoft.Practices.EnterpriseLibrary or Microsoft.Practices.ObjectBuilder assemblies?  I have an application that is using and has a reference to the 3.1 version of the EnterpriseLibrary.  In addition I am using a 3rd party assembly that is using the 2.0 version of the EnterpriseLibrary.  I need to use the 3.1 version as I am also using the Microsoft.Practices.CompositeWeb and Microsoft.Practices.CompositeWeb.EnterpriseLibrary assemblies.

Sep 3, 2009 at 2:04 AM

You just need to reference the correct assembly and separate different versions in different directories - http://msdn.microsoft.com/en-us/library/cc309068.aspx.  The different versions of the ObjectBuilder assemblies would also work (FAQ item: http://entlib.codeplex.com/Wiki/View.aspx?title=Will%20Object%20Builder%201.0%20work%20together%20with%20Object%20Builder%202.0%3f%20I%20am%20using%20Enterprise%20Library%203.1%2c%20which%20uses%20ObjectBuilder1.0%2c%20and%20would%20want%20to%20upgrade%20to%20Enterprise%20Library%204.0.&referringTitle=Home.)

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 3, 2009 at 3:53 PM

Thank you Sarah for your reply.  I am now trying to get the solution to compile by probing for the correct assemblies.  The solution is a web app that requires the CompositeWeb assemblies and yet has references to other assemblies that require the earlier versions of the EnterpriseLibrary framework libraries.  If you have any suggestions or tips on how to get the IDE to compile successfully with this scenario they will be appreciated.

Sep 3, 2009 at 8:21 PM
Edited Sep 3, 2009 at 8:30 PM

I cannot get the runtime to bind to the correct assemblies.  My bin structure is like so:

 WebApp

                |-------->\Bin

                                      |-------->\CB

                                      |-------->\CBOld

 

Here is the Assembly Binding redirect node from the web.config file: 

 

<runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <probing privatePath="Bin;Bin\CBOld;Bin\CB" />

      <!--

      <dependentAssembly>

        <assemblyIdentity

          publicKeyToken="b03f5f7f11d50a3a"

          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.1.0.0" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity

          publicKeyToken="b03f5f7f11d50a3a"

          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.1.0.0" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity

          publicKeyToken="b03f5f7f11d50a3a"

          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.1.0.0" />

      </dependentAssembly>

      -->

    </assemblyBinding>

  </runtime>

 And here is the Fusion Log:

 === Pre-bind state information ===

LOG: User = XPFL\ASPNET
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/DC/Dev/Work/DT_Core/Dev/DC/Source/MYAPP/MYAPP_WebApp_VB/
LOG: Initial PrivatePath = C:\DC\Dev\Work\DT_Core\Dev\DC\Source\MYAPP\MYAPP_WebApp_VB\bin
LOG: Dynamic Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\MYAPP\6047f7d7
LOG: Cache Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\MYAPP\6047f7d7
LOG: AppName = e3ea873b
Calling assembly : Microsoft.Practices.CompositeWeb.EnterpriseLibrary, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\DC\Dev\Work\DT_Core\Dev\DC\Source\MYAPP\MYAPP_WebApp_VB\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/MYAPP/6047f7d7/e3ea873b/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/MYAPP/6047f7d7/e3ea873b/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL.
LOG: Attempting download of new URL file:///C:/DC/Dev/Work/DT_Core/Dev/DC/Source/MYAPP/MYAPP_WebApp_VB/bin/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\DC\Dev\Work\DT_Core\Dev\DC\Source\MYAPP\MYAPP_WebApp_VB\bin\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

 

In the \Bin dir resides a copy of the assembly Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0

In the \Bin\CB dir resides a copy of the assembly Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0

And finally, in the \Bin\CBOld dir resides a copy of the assembly Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0

So what am I doing wrong here?  I believe that what is happening is that the assembly Microsoft.Practices.CompositeWeb.EnterpriseLibrary is calling for the 3.1.0.0 version of the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling assembly to be loaded but the CLR cannot locate it and the privatePath="Bin;Bin\CBOld;Bin\CB" attribute is not being respected.  But why?  Do I need to insert the various versions of the Microsoft.Practices Assemblies into the GAC?  Keep in mind that some dependent assemblies in my Web App are compiled against different versions of the Microsoft.Practices assemblies.