Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Confused about app.config codebase
Message
From
11/07/2011 10:30:04
 
 
To
All
General information
Forum:
ASP.NET
Category:
Installation, Setup and Configuration
Title:
Confused about app.config codebase
Environment versions
Environment:
C# 4.0
Miscellaneous
Thread ID:
01517867
Message ID:
01517867
Views:
93
I have two versions of the same assembly (Version=1.0.0.0 and Version=2.0.0.0) located in different sub folders of the bin directory. In app.config:
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity
          name="AnotherLib"
          publicKeyToken="null"
          culture="neutral"/>
        <codeBase
	Version="1.0.0.0"
	href="file:///D:\tmp\Probing Test\Probing Test\bin\Debug\V1\AnotherLib.dll"/>
      </dependentAssembly>
    </assemblyBinding>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity
          name="AnotherLib"
          publicKeyToken="null"
          culture="neutral"/>
        <codeBase
	version="2.0.0.0"
	href="file:///D:\tmp\Probing Test\Probing Test\bin\Debug\V2\AnotherLib.dll"/>
      </dependentAssembly>
    </assemblyBinding>
Trying to get an instance of a class in the assembly I try getting the Type by:
Type t1 = Type.GetType("AnotherLib.Class1, AnotherLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
Type t2 = Type.GetType("AnotherLib.Class1, AnotherLib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null");
but the Assembly for both types is version 1.0.0.0. Anyone know why this doesn't work. FWIW a similar pattern when dealing with strong named assemblies is locations outside the AppBase works fine.....

UPDATE: Also works if AnotherLib.dll is signed. Still don't know why that has to be tho.......
Reply
Map
View

Click here to load this message in the networking platform