Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly binding redirect in .NET Core

How do I do assembly binding redirect in .NET Core?

I found this question asked a few time with no solutions offered. The situation is trivial. I have a package refering to assembly A in version 10. I want to use assembly A in version 12. In a standard .NET it works perfectly with this:

<dependentAssembly>
  <assemblyIdentity name="Microsoft.AnalysisServices.AdomdClient" publicKeyToken="89845dcd8080cc91" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-15.1.52.23" newVersion="12.0.0.0" />
</dependentAssembly>
like image 698
Eliyahu Avatar asked Sep 29 '20 21:09

Eliyahu


People also ask

What is assembly binding redirect?

1 or a later version, the app uses automatic binding redirection. This means that if two components reference different versions of the same strong-named assembly, the runtime automatically adds a binding redirection to the newer version of the assembly in the output app configuration (app.

What is Assemblybinding?

<dependentAssembly> <assemblyIdentity name="FooBar" publicKeyToken="32ab4ba45e0a69a1" culture="en-us" /> <bindingRedirect oldVersion="7.0.0.0" newVersion="8.0.0.0" /> </dependentAssembly>

How do I add-BindingRedirect?

Open the NuGet Package Manager Console, specify the appropriate Default Project and enter the command Add-BindingRedirect. As if by magic, an app. config is added to the project (if one doesn't exist already) and the appropriate information added. Sweet!


1 Answers

With help of Rena, adding true to the project file helped. The .config file got autogenerated with the correct binding redirect.

like image 144
Eliyahu Avatar answered Oct 16 '22 21:10

Eliyahu