1

I'd like to add an assembly redirect for some libraries used by only one area of my ASP.NET MVC app. Not to clutter to root application Web.config, I'd like to have these redirects in the Web.config of the area.

Is this possible? Adding the following code to the area's Web.config doesn't seem to have an effect (while working from the root Web.config):

<runtime>
 <assemblyBinding>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Diagnostics.Tracing.EventSource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.1.14.0" newVersion="1.1.14.0" />
  </dependentAssembly>
 </assemblyBinding>
</runtime>
Piedone
  • 2,693
  • 2
  • 24
  • 43
  • 1
    Areas do not have their own `Web.Config`, it's only their Views that are benefited from the `~/AreaName/Views/Web.Config` configuration. – haim770 Dec 25 '14 at 14:20
  • It seems I was sharing too few details. It's an Orchard (http://orchardproject.net/) app where plugins (modules) are basically MVC areas, each sitting in their own project under the app's solution, and they have Web.config files (and none in the Views folders). Maybe this is something Orchard-specific then... – Piedone Dec 25 '14 at 14:29
  • Is there a technical reason why not to put it in the main `Web.config`? – haim770 Dec 25 '14 at 14:30
  • 1
    These areas are re-usable and can come from a variety of different sources. They shouldn't rely on manual changes to configurations out of their reach (and can't do Web.config changes themselves, not being e.g. NuGet packages). I solved this, in the end have written a bit of code for redirection: http://blog.slaks.net/2013-12-25/redirecting-assembly-loads-at-runtime/ Thanks for the help! – Piedone Dec 25 '14 at 19:37

0 Answers0