3
我有一個使用System.Web.Http.dll版本4的Umbraco 7.0網站,並且我想要集成使用System.Web.Http.dll第5版的Web API 2項目。我可以在同一個ASP.NET MVC網站上使用兩個版本的程序集嗎?
我已閱讀並嘗試了很多事情來試圖讓這兩個DLL工作,但現在我不太確定這是可能的。
我期望的工作是將dll放在單獨的文件夾中,並在web.config中引用它們。事情我已經嘗試:
<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>
我不斷收到一個兩個以下:
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'
也許這可以幫助http://stackoverflow.com/q/223195/340760 – BrunoLM