Jeffrey -
Thanks for the tip. I didn't think to try 2 different <codeBase> elements
in the <dependencyAssembly> element. However, I'm still stuck.
This is my web.config now:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ClassLibrary1"
publicKeyToken="a40ccc8d88606ee3"
culture="neutral" />
<codeBase version="1.3.1.200"
href="BiggerClassLibrary/ClassLibrary1.dll"/>
<codeBase version="0.9.1.65534" href="ClassLibrary1.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
The web application's "bin" directory has a subdirectory named
"BiggerClassLibrary" which contains the file "ClassLibrary1.dll", as well as
all the other files that are build when we build "BiggerClassLibrary". I
used Relector to copy/paste the public key token, and it is correct.
ClassLibrary1 is in 2 places -- the web application's "bin" directory and
the "BiggerClassLibrary" subdirectory under bin.
Maybe this is significant: ClassLibrary1 contains a ConfigurationSection
subclass that BiggerClassLibrary specializes. There is a section, elsewhere
in web.config, that contains the configuration for BiggerClassLibrary.
So, to be clear, I've this :
<configuration>
<configSections>
<sectionName = "BiggerLibrary" type="BiggerClassLibraryConfig,
BiggerClassLibrary">
...
</configSections>
<runtime>
.. as above
</runtime>
...
<BiggerLibrary ... />
</configuration>
If the regular ConfigurationSection loader stuff uses dynamic loading which
itself uses the <assemblyBinding> configuration to find assemblies, then
this shouldn't matter, right?
If I turn on the Fusion Registry entry, shouldn't I see the
BiggerClassLibrary directory added to the list of places searched? I do not
see it.
I get an error creating the configuration section handler -- that handler is
in BiggerClassLibrary -- saying that it could not load ClassLibrary1 v
1.3.1.200 or one of its dependencies. The located assembly's manifest
definition does not match the assembly reference. (Exception from HRESULT
0x80131040).
Any more suggestions?
Howard
[quoted text, click to view] ""Jeffrey Tan[MSFT]"" <jetan@online.microsoft.com> wrote in message
news:4aetn$m9GHA.1860@TK2MSFTNGXA01.phx.gbl...
> Hi Howard,
>
> Yes, what you want can be achieved in .Net. This is called Side-By-Side
> execution.
>
> I have written 3 sample test projects to demonstrate your situation:
> SxSTest, AddinPrj and ClassLibrary1. The SxSTest is a winform application
> for simplicity which uses the 1.0.0.0 version of ClassLibrary1. AddinPrj
> is
> the Addin project that uses the 2.0.0.0 version of ClassLibrary1. Below is
> the test code:
>
> //ClassLibrary1 version 1.0.0.0
> namespace ClassLibrary1
> {
> public class Class1
> {
> public static int StaticMethod(int a, int b)
> {
> return a+b;
> }
> }
> }
>
> //ClassLibrary1 version 2.0.0.0
> namespace ClassLibrary1
> {
> public class Class1
> {
> public static int StaticMethod(int a, int b)
> {
> return a*b;
> }
> }
> }
>
> //AddinPrj project
> namespace AddinPrj
> {
> public class AddIn
> {
> public static int AddInMethod()
> {
> return ClassLibrary1.Class1.StaticMethod(5, 6);
> }
> }
> }
>
> //SxSTest
> private void button1_Click(object sender, System.EventArgs e)
> {
> MessageBox.Show(ClassLibrary1.Class1.StaticMethod(5, 6).ToString());
> }
>
> private void button2_Click(object sender, System.EventArgs e)
> {
> MessageBox.Show(AddinPrj.AddIn.AddInMethod().ToString());
> }
> I placed the 1.0.0.0 and 2.0.0.0 version of ClassLibrary1 in "V1" and "V2"
> subdirectory of the Exe bin folder.
>
> During the testing, I found that the Probing privatePath can not be used
> to
> notify the runtime to load the assembies with the same name. We should use
> the <codeBase> element to configure the runtime the correct loading path.
> For example, in my test scenario, the below app.config file works for me:
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <runtime>
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
> <dependentAssembly>
> <assemblyIdentity name="ClassLibrary1"
> publicKeyToken="270aa85ff6943c10" />
> <codeBase version="1.0.0.0" href="V1/ClassLibrary1.dll"/>
> <codeBase version="2.0.0.0" href="V2/ClassLibrary1.dll"/>
> </dependentAssembly>
> </assemblyBinding>
> </runtime>
> </configuration>
>
> So you may add the same syntax of <codeBase> to your Asp.net application's
> web.config file, the runtime will happily load the 2 different versions of
> assembly 'A'. I have tested above code under both .Net1.1 and .Net2.0, if
> it still does not work for you, please feel free to tell me, thanks.
>
> Finally, below is the official document regarding how the runtime locates
> the assemblies. Please note the "Multiple Assemblies with the Same Name"
> section, it means "multiple assemblies with the same name" should use
> <codeBase> as the configuration element.
>
http://msdn2.microsoft.com/en-us/library/15hyw9x3.aspx >
> Hope this helps.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Community Support
> ==================================================
> Get notification to my posts through email? Please refer to
>
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
>
http://msdn.microsoft.com/subscriptions/support/default.aspx. > ==================================================
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>