are assembly bindings ignored for PublicKeyToken=null?
Asked Answered
P

1

22

I have the following in my app.config.

<configuration>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <probing privatePath="bin2" />
    <dependentAssembly>
      <assemblyIdentity name="Foo" culture="neutral" publicKeyToken="null">
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.4497.27619" />
      </assemblyIdentity>
    </dependentAssembly>
  </assemblyBinding>
  ...
<configuration>

Fusion logging tells me that it's not looking in bin2 for my assembly.

LOG: Initial PrivatePath = NULL (and it never searches in bin/Debug/bin2/Foo)

Is this a problem with not having a publicKeyToken?

Petiole answered 25/4, 2012 at 22:57 Comment(0)
N
23

Yes, they are ignored for assemblies that are not strong named (have a publicKeyToken) since the CLR ignores version numbers for these assemblies.

See this MSDN page for more information.

Nutcracker answered 21/12, 2012 at 8:34 Comment(2)
The specific note on the page says: "You cannot redirect versions for assemblies that are not strong-named. The common language runtime ignores the version for assemblies that are not strong-named."Petiole
@JJS: For .NET 4.5 that note does not exist. It is not clear, though, whether the behaviour has changed.Sciuroid

© 2022 - 2024 — McMap. All rights reserved.