C# 使用包管理器控制台卸载 EntityFramework

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17653633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 10:06:42  来源:igfitidea点击:

Uninstall EntityFramework using the Package Manager Console

c#entity-framework

提问by Andre Lombaard

I'm trying to re-install my EntityFramework package using

我正在尝试使用重新安装我的 EntityFramework 包

PM> Install-Package EntityFramework

But I get the following message

但我收到以下消息

'EntityFramework 5.0.0' already installed. already has a reference to 'EntityFramework 5.0.0'.

'EntityFramework 5.0.0' 已经安装。已经引用了“EntityFramework 5.0.0”。

So I tried to uninstall the package using

所以我尝试使用卸载包

PM> Uninstall-Package EntityFramework -Force

But I keep on getting the following message

但我不断收到以下消息

Uninstall-Package : Unable to find package 'EntityFramework'.
At line:1 char:1
+ Uninstall-Package EntityFramework -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Uninstall-Package], InvalidOperationException

How do I re-install the package?

如何重新安装软件包?

采纳答案by BlackICE

Try deleting it out of the project references, and out of packages.config. Then re-add it.

尝试将其从项目引用中删除,并从packages.config. 然后重新添加它。

回答by Oleksandr Kobylianskyi

  1. Try it without -Force.
  2. Try to specify -ProjectName parameter and execute it over each project that includes the EntityFramework package.
  1. 不用 -Force 试试。
  2. 尝试指定 -ProjectName 参数并在包含 EntityFramework 包的每个项目上执行它。

回答by Red

To remove/uninstall: In the Package Manager Console run:

删除/卸载:在包管理器控制台中运行:

UnInstall-Package EntityFramework -Version 6.0.2

UnInstall-Package EntityFramework -Version 6.0.2

回答by makdu

You can run following command in package manager

您可以在包管理器中运行以下命令

UnInstall-Package EntityFramework

UnInstall-Package EntityFramework

Then Install the needed package using

然后使用安装所需的包

Install-Package EntityFramework -Version 5.0.0

回答by ???? ?????

I experienced a similar issue, and it came down to an incorrect path. You are unable to find the package as the full namespace for Entity Framework is Microsoft.AspNet.Identity.EntityFramework.

我遇到了类似的问题,归结为不正确的路径。您无法找到包,因为实体框架的完整命名空间是 Microsoft.AspNet.Identity.EntityFramework。

Therefore, to uninstall you need to enter the following into the Package Manager:

因此,要卸载,您需要在包管理器中输入以下内容:

Uninstall-Package Microsoft.AspNet.Identity.EntityFramework

Uninstall-Package Microsoft.AspNet.Identity.EntityFramework

回答by DKR

In Package Manager Console you can write following command:

在包管理器控制台中,您可以编写以下命令:

Uninstall-package EntityFramework -force

卸载包 EntityFramework -force

回答by Vasanth Ponnupandi

if you have the connection string with provider name on it . Then make sure the provider name have definition below as in the config (providers)(provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /)(/providers)

如果您有带有提供程序名称的连接字符串。然后确保提供者名称在配置中具有以下定义(提供者)(provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /)(/providers)

回答by BigBucks

Make sure any EntityFramework files are deleted from the File Explorer project folder after you do the top answer.

确保在完成最佳答案后从文件资源管理器项目文件夹中删除了所有 EntityFramework 文件。

回答by Sirajudeen N.Ismail

I have been facing this issue for days. To solve the issue I tried the latest version of framework, uninstalled it and installed previous version. All the possibilities tried were not working for me. At last, I found a solution and just run the below command at Package manger Console.

我已经面临这个问题好几天了。为了解决这个问题,我尝试了最新版本的框架,将其卸载并安装了以前的版本。尝试的所有可能性都不适合我。最后,我找到了一个解决方案,只需在包管理器控制台运行以下命令即可。

PM>install-Package Microsoft.AspNet.Identity.EntityFramework

everything is done by itself. Uninstalling old version and installing the latest version of Ef under Microsoft.AspNet.Identity.EntityFramework 2.2.2and it updates the files of my project by itself.

一切都是自己完成的。卸载旧版本并安装最新版本的 EfMicrosoft.AspNet.Identity.EntityFramework 2.2.2并自行更新我的项目文件。

After installation, the image below show what I have by going to tools->Nuget Packagemanager->package visualizer

安装后,下图显示了我通过转到工具-> Nuget Packagemanager->package Visualizer

enter image description here

在此处输入图片说明