Eliminating assembly binding redirects when targeting the .Net framework

We have a solution with 100+ projects (part of a big ugly .Net Framework Monolith app). Now we are pushing to move as much code as possible as NuGet packages to our internal repo. But now we are in a dependency hell, because even though all of our code is unsigned, most of the 3rd party NuGets are signed. As well as all the Microsoft packages.

This hell got worse since we migrated from packages.config to PackageReference, because many dependencies became implicit (being transitive). On one hand we want to use PackageReference, because:

  1. It is a step closer to moving to SDK style projects, where possible.
  2. Precisely, because it shows what we use without cluttering the project with transitive deps.
  3. It is the future, right?

But on the other hand it is hellish to sort through all these binding redirects. And the worst thing - it is not consistent from msbuild to VS IDE, see Why does console build generate radically different project.assets.json than that generated with VS IDE build?

I want to get rid of them once and for all. My idea is:

  1. Suppress all the warnings related to binding redirects - MSB3277 and MSB3247
  2. Remove them from all the config files
  3. Resolve assemblies at runtime with a dedicated code

I wonder if anyone has tried this approach. Cannot be that we are the only ones that are struggling with the binding redirects, this device of torture inflicted upon us undoubtfully for the sin of programming .Net rather than Java.

I have a concrete question - has anyone succeeded in replacing all the config time assembly binding redirects with a logic at runtime? I want to suppress all of the binding redirect related warnings and forget about them once and for all while staying in .Net Framework (not Core) realm.



from Recent Questions - Stack Overflow https://ift.tt/2I3WV1S
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Today Walkin 14th-Sept

Object oriented programming concepts (OOPs)