3

I have an Umbraco 7.0 website which uses System.Web.Http.dll version 4, and I want to integrate a Web API 2 project which uses System.Web.Http.dll version 5.

I've read and tried many things to try to get both dlls working, but now I'm not so sure it's possible.

What I would expect to work is putting the dlls in separate folders, and referencing them in the web.config. Things I've tried:

<configuration>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="bin;c:\umbraco\dll\folder;c:\webapi\dll\folder"/>
    </assemblyBinding>
    </runtime>
</configuration>

<dependentAssembly>
    <assemblyIdentity name="System.Web.Http"  culture="neutral" publicKeyToken="31bf3856ad364e35"/>
    <codeBase version="4.0.0.0" href="FILE:c:\umbraco\dll\folder\System.Web.Http.dll"/>
</dependentAssembly>

<dependentAssembly>
    <assemblyIdentity name="System.Web.Http"  culture="neutral" publicKeyToken="31bf3856ad364e35"/>
    <codeBase version="5.0.0.0" href="FILE:c:\webapi\dll\folder\System.Web.Http.dll"/>
</dependentAssembly>

I keep getting one of the two following:

CS0012: The type 'System.Web.Http.HttpConfiguration' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

CS1705: Assembly 'WebApi2Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
MStodd
  • 4,716
  • 3
  • 30
  • 50

1 Answers1

0

It's not possible. The appdomain will load one of the dlls and then will try to upload the other one but you will get assembly mismatch error.

Dennis Nerush
  • 5,473
  • 5
  • 25
  • 33