1

We have a question about assembly binding redirection at compile time:

  • Team V (the Veterans) is developing Product P1
  • P1 is continuously developed by Team V in two branches (branch 1.6.x and 1.7.x), so the version from Product P1 is incrementing over time in both branches
  • Team NG (New Generation) has built a Product P2 based on Product P1 (using certain assemblies from P1 branch 1.7)
  • Product P2 contains an Assembly A2 (strongly named) that helps implementing any Product (P2, P3...) that is based on P1
  • Team NG created a Nuget Package for Assembly A2 (which is referring certain assemblies from P1 branch 1.7)
  • Now, Team NG has started Product P3 and has to use Assembly A2 from P2 and an Assembly A1 from P1
  • Assembly A1 from P1 is also available as Nuget Package, but in version 1.6 (because 1.7 is not approved yet for Product P3)
  • So Team NG has now Product P3 with two references: A2 and A1
  • The problem now is, that A2 refers A1 in version 1.7 but we only have A1 in version 1.6
  • Team NG is not allowed to use A1 in version 1.7

This is why we are looking for a binding redirect at compile time for strongly named assemblies. As far as I know (by investigations), the 'Specific Version' property has no effect when setting this for a strongly named assembly.

Is such a redirection possible or are there any other suggestions?

Many thanks in advance Regards, Michael

Michael
  • 11
  • 6

1 Answers1

1

The bindingRedirect element of app.config/web.config files applies to runtime only (not compile-time).

At compile-time, the compiler does not insist on references having like version numbers, unless a reference has the SpecificVersion element set to True in a project file.

Strong-naming vs. non-strong-naming shouldn't be a factor with this.

See also How exactly does the "Specific Version" property of an assembly reference work in Visual Studio?

Community
  • 1
  • 1
Dave Clausen
  • 1,302
  • 1
  • 12
  • 23
  • 1
    The first statement is incorrect. Here's a resource that mentions that compile time is also affected: https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions. In my company we've also created a PoC that proves this. Different binding redirects end up with different library versions in the bin folder. I have no knowledge regarding the second statement. The third statement is also incorrect, only strong-named assemblies seem to be affected by binding redirects, at least at compile time. The compiler seems to ignore non-strong named assembly binding redirects. – tsemer Jan 21 '19 at 11:16