Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法加载文件或程序集';WebMatrix.Data`_C#_Asp.net Mvc_Asp.net Mvc 4_Asp.net Mvc 5_Web Config - Fatal编程技术网

C# 无法加载文件或程序集';WebMatrix.Data`

C# 无法加载文件或程序集';WebMatrix.Data`,c#,asp.net-mvc,asp.net-mvc-4,asp.net-mvc-5,web-config,C#,Asp.net Mvc,Asp.net Mvc 4,Asp.net Mvc 5,Web Config,我将MVC4更新为MVC5。运行应用程序时,我收到一个错误,我没有WebMatrix.Data。我安装了它PM>安装包WebMatrix.Data。现在,当您开始进入浏览器时: 无法加载文件或程序集WebMatrix.Data,版本=3.0.0.0, 区域性=中性,PublicKeyToken=31bf3856ad364e35'或其 依赖关系。定位程序集的清单定义不匹配 程序集引用。(来自HRESULT的异常:0x8013100) 有人知道怎么解决这个问题吗 软件包管理器控制台日志 Attemp

我将MVC4更新为MVC5。运行应用程序时,我收到一个错误,我没有
WebMatrix.Data
。我安装了它
PM>安装包WebMatrix.Data
。现在,当您开始进入浏览器时:

无法加载文件或程序集WebMatrix.Data,版本=3.0.0.0, 区域性=中性,PublicKeyToken=31bf3856ad364e35'或其 依赖关系。定位程序集的清单定义不匹配 程序集引用。(来自HRESULT的异常:0x8013100)

有人知道怎么解决这个问题吗

软件包管理器控制台日志

Attempting to resolve dependency 'Microsoft.AspNet.WebPages.Data (≥ 2.0.20710.0)'.
Installing 'WebMatrix.Data 2.0.30506.0'.
You are downloading WebMatrix.Data from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/aspnetcomponent_rtw_enu.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'WebMatrix.Data 2.0.30506.0'.
Adding 'WebMatrix.Data 2.0.30506.0' to xxx.
Successfully added 'WebMatrix.Data 2.0.30506.0' to xxx.`
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.AspNet.Identity.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebMatrix.WebData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
一段代码Web.config

Attempting to resolve dependency 'Microsoft.AspNet.WebPages.Data (≥ 2.0.20710.0)'.
Installing 'WebMatrix.Data 2.0.30506.0'.
You are downloading WebMatrix.Data from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/aspnetcomponent_rtw_enu.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'WebMatrix.Data 2.0.30506.0'.
Adding 'WebMatrix.Data 2.0.30506.0' to xxx.
Successfully added 'WebMatrix.Data 2.0.30506.0' to xxx.`
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.AspNet.Identity.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebMatrix.WebData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

进入:
工具>NuGet软件包管理器>软件包管理器控制台

并运行以下命令:

PM> Install-Package Microsoft.AspNet.WebPages.Data

这实际上是一个遗留库。如果要从MVC 4升级到MVC 5,则应改为安装Microsoft.AspNet.WebPages.Data

PM> Install-Package Microsoft.AspNet.WebPages.Data
这同样有效

Update-Package Microsoft.AspNet.WebPages.Data

这就是我的工作。花了几个星期才弄明白

确保您的目标框架符合您的要求(我有
4.6.1


进入:
Tools>NuGet Package Manager>Package Manager控制台
,然后执行以下命令

Uninstall-Package Microsoft.AspNet.WebHelpers
Uninstall-Package Microsoft.AspNet.WebPages.OAuth
Uninstall-Package Microsoft.AspNet.WebPages.WebData
Uninstall-Package Microsoft.AspNet.WebPages.Data

Install-Package Microsoft.AspNet.WebPages.Data
Install-Package Microsoft.AspNet.WebPages.WebData
Install-Package Microsoft.AspNet.WebPages.OAuth
Install-Package Microsoft.AspNet.WebHelpers

希望这能帮助那些尝试过其他解决方案但运气不佳的人。

从您的package manager控制台,我可以看到您的项目已成功地将“WebMatrix.Data 2.0.30506.0”添加到xxx`


因此,让您的web.config与WebMatrix.Data 2.0.30506.0同步。

安装MVC 4(不是运行时,而是完整版本)为我修复了它。

您阅读了吗?我阅读了。现在我得到了编译器
找不到类型或名称空间名称“WebMatrix”(您是否缺少using指令或程序集引用?
好吧,您已经阅读了,但是您从建议的解决方案中尝试了什么?是的,为我这样做了--必须更改为其中一个引用的“复制本地”,但是我已经开始做我的种子了:D--谢谢!我共享了依赖旧版本的依赖项目。我必须浏览所有的参考资料并进行更新以使其正常工作。。。这迫使我将我所有站点上的一个站点从MVC4升级到5。。。提前知道这一点,我可能会采取不同的做法…我安装了一些随机的NuGet软件包,得到了与OP相同的错误。我安装了这个奇怪的软件包,它解决了这个问题。为什么一开始这甚至是一个问题?这个错误是怎么产生的?很好的解决方案,thx兄弟!我在其他解决方案上运气不佳,但这确实帮助了我:)解释你的答案?为什么初始问题中的程序失败?请参阅配置文件中的这一行,它表示新版本为3.0.0.0,但安装的版本与之不匹配,因此它们需要同步。