Why do many assembly binding errors occur only after running an application and not at compile time? Is there a compiler switch to force a strong resolution of assembly bindings during compile?
Example:
We had an ASP.NET web project with NuGet packages for webapi v5.2.6 and it referenced a class library project with NuGet packages for web api v 5.2.3 (or the versions were switched vice versa, I do not recall specifically).
The project compiled fine and we deployed.
At runtime, it failed to startup with assembly binding errors stating that binaries for 5.2.3 could not be found.
We opened the solution back up, check NuGet consolidate, applied the consolidation recommendations, rebuilt, redeployed and everything worked fine.