How can I indicate that several versions of the dependent assembly are in order?

Assemblies A and B are privately deployed and strongly named. Assembly A contains references to assembly B. There are two versions of assembly B: B1 and B2. I want to be able to indicate for assembly A that it can communicate with B1 or B2 - ideally, by including this information in the assembly itself. What are my options?

I am a little familiar with the version control policy and how it applies to the GAC, but I do not want to be dependent on these assemblies located in the GAC.

+3
source share
2 answers

There are several places you can tell the .NET Framework that a particular version of a strongly typed library should be preferred over another. It:

  • Publisher Policy File
  • machine.config
  • app.config

"<bindingRedirect> " .Net Framework .

2.0 2.5:

<assemblyBinding>
    <dependantAssembly>
        <assemblyIdentity name="foo" publicKeyToken="00000000000" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0 - 2.0.0.0" newVersion="2.5.0.0" />
    </dependantAssembly>
</assemblyBinding>

, MSDN, , .

+2

app.config. Assembly.LoadFrom(), , .

+1

Source: https://habr.com/ru/post/1696779/


All Articles