且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法加载文件或程序集“WebMatrix.Data,版本= 3.0.0.0

更新时间:2023-02-24 21:14:22

这是(由同事做一个样品或工作),你已经下载了,你已经创建了一个解决方案,或者一个?你有一个高达Visual Studio中安装的NuGet的数据版本,你检查安装的软件包项目 - 你可能需要恢复的包,如果你已经下载了从源代码管理或作为一个zip样品在线解决方案。

要做到这一点,最简单的方法就是检查的NuGet包管理器是最新在工具> 扩展和更新,然后(在Visual Studio中选择适用的项目)中选择项目> 管理的NuGet包。如果安装了这是不是在你的解决方案包目录中的软件包则应该的NuGet提供以恢复它们。

另外,您可能已添加这对那个包的依赖包,你要么不安装它还是有previous版本。

要的NuGet包管理器控制台类型中安装包 -


  

安装封装Microsoft.AspNet.WebPages.Data ​​ P>
块引用>

或者在管理的NuGet包窗口搜索Microsoft.AspNet.WebPages.Data,通过上面的指令访问。

如果您已经安装了软件包的先前版本,您可能需要重新映射版本号为版本3.0.0.0,在您的项目配置以下code(最有可能的Web.config)文件,以避免破坏封装,在previous版本依赖 -

 < dependentAssembly>
  < assemblyIdentity名称=WebMatrix.Data公钥=31bf3856ad364e35文化=中性/>
  < bindingRedirect oldVersion =0.0.0.0-2.0.0.0NEWVERSION =2.0.0.0/>
< / dependentAssembly>

Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Is this a solution that you have created or one you have downloaded (as a sample or as work done by a colleague)? Do you have an up to data version of NuGet installed within Visual Studio and have you checked installed packages for the project - you may need to restore packages if you have downloaded the solution from Source Control or as a zip sample online.

The easiest way to do this is to check that NuGet Package Manager is up to date in "Tools" > "Extensions and Updates" and then (with the applicable project selected in Visual Studio) select "Project" > "Manage NuGet Packages". If there are installed Packages which are not found in your solution packages directory then NuGet should offer to restore them for you.

Alternatively you may have added a package which has a dependency on that package, and you either do not have it installed or have a previous version.

To install the package within NuGet Package Manager Console type-

Install-Package Microsoft.AspNet.WebPages.Data

Or search for "Microsoft.AspNet.WebPages.Data" in the "Manage NuGet Packages" window, accessed via the instructions above.

If you have a prior version of the package installed, you may need to remap that version number to the version 3.0.0.0 with the following code in your project config (most likely Web.config) file in order to avoid breaking packages with dependencies on the previous version-

<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>