2

我最近安装了最新的 Win8 OS (RTM) 并安装了 MSVC 2012 RTM(我还安装了 MSVC 2010,因为我正在从 Win7 手机移植到 Win 8 平板电脑并且需要参考旧代码(不确定这是否可能影响结果))。我需要在 MSVC 2012 中安装实体框架,当我查看 NuGet 包管理器时,它告诉我版本 5.0.0。可用。但是它永远不会正确安装,它说它已经安装成功,然后说它不能并卸载它。我尝试使用 NuGet 包管理器和 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

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

出了什么问题?请帮忙。

布伦达

4

2 回答 2

1

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

于 2012-08-30T14:25:12.003 回答
0

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

从包管理器控制台:

PM> Uninstall-Package EntityFramework -Force

这引发了一个错误。然后我转到解决方案文件夹下的“包”文件夹并删除了实体框架子文件夹。然后我跑了

PM> Install-Package EntityFramework

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

于 2013-01-02T21:48:14.673 回答