From http://stackoverflow.com/questions/17863627/msbuild-cannot-find-a-dll-that-has-been-bindingredirectd-via-web-config
It seems that despite loading the System.Web.* binaries into the AppDomain, invoking the WebConfigurationManager complains about not being able to find the binaries
Comments: The problem isn't with msbuild \ csc, it's with the way the ConfigurationManager loads assemblies when it sees a config section. Perhaps Assembly.LoadFrom does not check if an Assembly is already loaded into the AppDomain. Regardless, the idea would be to refactor it so that the event handler is only assigned once and that it does not affect the VS tooling (they share the same code path). I can get around to it by today evening.
It seems that despite loading the System.Web.* binaries into the AppDomain, invoking the WebConfigurationManager complains about not being able to find the binaries
Comments: The problem isn't with msbuild \ csc, it's with the way the ConfigurationManager loads assemblies when it sees a config section. Perhaps Assembly.LoadFrom does not check if an Assembly is already loaded into the AppDomain. Regardless, the idea would be to refactor it so that the event handler is only assigned once and that it does not affect the VS tooling (they share the same code path). I can get around to it by today evening.