1

我有一个 MVC3 应用程序,它依赖于引用 MVC1 的 DotNetOpenAuth 库。当我安装 DotNetOpenAuth NuGet 包时,它向我的 web.config 添加了程序集绑定重定向。我取消了它的注释,但没有任何改变。

经过一番搜索,我发现这通常是一个拼写错误的原因,但是我怀疑这是否适用于我,我检查了至少十几次配置是否有拼写错误。

我将 web.config 剥离为以下内容:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

在构建期间,我收到以下警告:

Consider app.config remapping of assembly "System.Web.Mvc, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [] to Version "3.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll] to solve conflict and get rid of warning.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.

我在 web.config 中尝试了很多不同的组合(例如,添加culture="neutral" 属性),但没有成功,而且我已经没有想法了。有什么建议么?

更新 我的 ~/Views/web.config 在这里

4

1 回答 1

2

在类似的情况下,对于 .NET Framework 4.5 项目,Visual Studio 2013 最近将我指向这篇 MSDN 文章:

如何:启用和禁用自动绑定重定向

顺便说一句:它对我们有用,至少在从 VS 运行构建时。相反,从命令行脚本运行构建时它没有任何效果。

于 2014-08-26T19:29:24.173 回答