<p>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 may bind to either B1 or B2 -- ideally, by incorporating this information into the assembly itself.  What are my options?</p>

<p>I'm somewhat familiar with versioning policy and the way it applies to the GAC, but I don't want to be dependent on these assemblies being in the GAC.</p>

[{'answer_id': 54553, 'author': 'Aaron Fischer', 'author_id': 5618, 'author_profile': 'https://Stackoverflow.com/users/5618', 'pm_score': 1, 'selected': False, 'text': '<p>You can set version policy in your app.config file.  Alternatively you can manually load these assemblies with a call to <code>Assembly.LoadFrom()</code> when this is done assembly version is not considered.</p>\n'}, {'answer_id': 55560, 'author': 'Adrian Clark', 'author_id': 148, 'author_profile': 'https://Stackoverflow.com/users/148', 'pm_score': 3, 'selected': True, 'text': '<p>There are several places you can indicate to the .Net Framework that a specific version of a strongly typed library should be preferred over another.  These are:</p>\n\n<ul>\n<li>Publisher Policy file</li>\n<li>machine.config file</li>\n<li>app.config file</li>\n</ul>\n\n<p>All these methods utilise the <a href="http://msdn.microsoft.com/en-us/library/eftw1fys.aspx" rel="nofollow noreferrer" title=".NET Framework General Reference - &lt;bindingRedirect&gt; Element">"&lt;bindingRedirect&gt;"</a> element which can instruct the .Net Framework to bind a version or range of versions of an assembly to a specific version.</p>\n\n<p>Here is a short example of the tag in use to bind all versions of an assembly up until version 2.0 to version 2.5:</p>\n\n<pre><code>&lt;assemblyBinding&gt;\n    &lt;dependantAssembly&gt;\n        &lt;assemblyIdentity name="foo" publicKeyToken="00000000000" culture="neutral" /&gt;\n        &lt;bindingRedirect oldVersion="0.0.0.0 - 2.0.0.0" newVersion="2.5.0.0" /&gt;\n    &lt;/dependantAssembly&gt;\n&lt;/assemblyBinding&gt;\n</code></pre>\n\n<p>There are lots of details so it\'s best if you read about <a href="http://msdn.microsoft.com/en-us/library/7wd6ex19.aspx" rel="nofollow noreferrer" title=".NET Framework Developer\'s Guide - Redirecting Assembly Versions">Redirecting Assembly Versions on MSDN</a> to decide which method is best for your case.</p>\n'}]
['https://Stackoverflow.com/questions/54546', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/533/']