How the assembly version matching works exactly?
.net, c#
Solution
If your reference requires a specific version, by default, it will fail on assembly load, as that version doesn't exist.
This can be configured, however, via Assembly Binding Redirection. There are various options of what will happen here, including:
- The reference can say that it doesn't care about versioning, in which case the newest is loaded.
- You can configure your application in a way that you specify how to redirect the binding.
- The assembly in the GAC can be setup with a publisher policy that specifies how to handle this.
Problem
Let's say I have assemblies in GAC with versions, 1.1.1.5, 1.1.5.1, 1.1.6.2, 1.2.1.1 and 2.1.2.1. My application have a reference of 1.1.3.0 version. Which assembly will be matched at runtime? and what are the actual rules for assembly matching?