How can I solve this System.Web.Helpers mismatch on Azure web deploy?

▼魔方 西西 提交于 2019-12-12 11:00:44

问题


I don't know why I can't seem to figure this out. I'm in a bit of DLL strong-naming hell. Here's what's happening:

  • I'm using Visual Studio 2012 RC to make an MVC4 site targeting .NET 4.0
  • I'm attempting to use the Gravatar Razor helper in the Microsoft.Web.Helpers library
  • It works on my machine, but after deploying to Azure via Git, I get the following exception on invoking the Gravatar helper:

    Could not load file or assembly 'System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

It seems that I've got a mismatch between the version of System.Web.Helpers installed on the GAC of whatever's hosting my Azure site and what I'm targeting.

Here's what I've tried:

  • Copy Local = true
  • Hacking my own _bin_deployableAssemblies folder, since the menu option seems to be missing described on Phil Haack's blog
  • Removing the extended assembly information in the .csproj file for System.Web.Helpers

Also, I have the following assembly binding redirect in the web.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      ...
</runtime>

Anyone??


回答1:


You said you tried copylocal=true, but have you ensured that the assembly is getting deployed to the server?

A potential issues:

• .gitignore has a .dll filter

I would FTP to the server and check to ensure the assembly is actually in the bin directory



来源:https://stackoverflow.com/questions/11641976/how-can-i-solve-this-system-web-helpers-mismatch-on-azure-web-deploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!