该项目在本地运行良好,仅在发布时出现以下错误:
无法加载文件或程序集“System.Web.Razor”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常:0x80131040)
过去几个小时在谷歌上搜索问题似乎是我添加到项目中的一个 nuget 包引用了 razor 1 并覆盖了我的 razor 2 dll。我尝试将 razor 2.0.0.0 dll 复制到引用而不是 1 但错误仍然存在。这是详细构建输出中显示冲突的地方:
There was a conflict between "System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
1> "System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
1> References which depend on "System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll].
1> C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll
1> Project file item includes which caused reference "C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll".
1> System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
1> References which depend on "System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Users\Jack\SkyDrive\LessonUp.Current\packages\RazorEngine.3.0.8\lib\net40\System.Web.Razor.dll].
1> C:\Users\Jack\SkyDrive\LessonUp.Current\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll
1> Project file item includes which caused reference "C:\Users\Jack\SkyDrive\LessonUp.Current\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll".
1> System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
1> Recaptcha
从那里它继续根据剃刀 2 列出其他软件包。
我添加到项目中的包是:Recaptcha、Recaptcha.mvcModel 和 Postal。
有谁知道我可以采取哪些步骤来解决这个问题?
让我知道是否有更多信息可以提供可能导致解决方案的信息。