Mittwoch, 13. Februar 2013

How to redirect assembly versions in .NET


.NET Assembly versions can be redirected in application, publisher policy, or machine configuration files.
The assemblies need to be signed == have a strong name. If they are not signed, the version is not taken into account by calling assemblies.
Slashdot had it's take on that here.

This example shows how to redirect in the app.config file
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <publisherPolicy apply="no" />
      <dependentAssembly>
        <!-- i stumbled over this one: i started using culture="en-us", that failed. -->
        <assemblyIdentity name="MyDependant.Assembly.ToRedirect"
          publicKeyToken="cf95ca7471e897ff"
          culture="Neutral" />
        <!--  -->
        <bindingRedirect oldVersion="1.0.0.0-1.0.0.163" newVersion="1.0.0.163" />
        <publisherPolicy apply="no" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

Keine Kommentare:

Kommentar veröffentlichen