实体框架5安装在win8 MSVC2012 RTM上

时间:2012-08-30 13:49:58

标签: windows-8 entity-framework-5

我最近安装了最新的Win8操作系统(RTM)并安装了MSVC 2012 RTM(我也安装了MSVC 2010,因为我从Win7手机移植到Win 8平板电脑,需要参考旧代码(不确定)如果这可能影响结果))。我需要在MSVC 2012中安装Entity Framework,当我查看NuGet Package Manager时,它告诉我5.0.0版本。是可用的。但它永远不会正确安装,它表示已成功安装,说它不能并卸载它。我尝试过使用NuGet Package Manager和PM控制台,PM控制台的结果如下:

PM> Install-Package EntityFramework
You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=253898&clcid=0x409. 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 'EntityFramework 5.0.0'.
Successfully uninstalled 'EntityFramework 5.0.0'.
Install failed. Rolling back...
Install-Package : Could not install package 'EntityFramework 5.0.0'. You are trying to install this package into a project that targets '.NETCore,Version=v4.5', but 
the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package EntityFramework
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

当我在安装过程中查看packages文件夹时,它似乎都存在然后被删除。我在我的用户帐户上设置了管理员权限。

出了什么问题?请帮助。

布伦达

2 个答案:

答案 0 :(得分:1)

您正在将EntityFramework包添加到Windows 8应用程序或类库项目(=到Metro应用程序)。那是不支持的。您必须使用完整的.NET Framework 4.5(=桌面应用程序,Web应用程序等)才能使用Entity Framework。

答案 1 :(得分:0)

我有这个问题。这就是我所做的:

从包管理器控制台:

PM> Uninstall-Package EntityFramework -Force

这引发了一个错误。然后我转到解决方案文件夹下的“packages”文件夹并删除了Entity Framework子文件夹。然后我跑了

PM> Install-Package EntityFramework

然后右键单击我想安装EF的项目,并从NuGet对话框中安装它。

相关问题