How can I solve this System.Web.Helpers mismatch o

2019-06-22 02:02发布

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条回答
成全新的幸福
2楼-- · 2019-06-22 02:25

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

查看更多
登录 后发表回答