gpt4 book ai didi

c# - 无法创建 asp net core 2.0 web api

转载 作者:太空宇宙 更新时间:2023-11-03 21:00:09 27 4
gpt4 key购买 nike

我的 Web Api 项目遇到了严重的问题。我无法安装 entityframework 也无法更新项目的任何更新。尝试在那里更新会给我错误“包恢复失败。回滚包更改”。

首先,我无法使用 asp net core 创建项目,只能使用 1.1 版本,即使我安装了正确的版本。看这两张照片。 enter image description here

enter image description here

如您所见,它已安装。

当我尝试更新这些时: enter image description here

我得到这个错误: enter image description here

尝试安装 Entity Framework 给我: enter image description here

如何将我的项目升级到 asp net core 2.0 或至少创建一个新的 2.0 项目?

最佳答案

在 Visual Studio 2017 版本 15.3 中添加了对 ASP.NET Core 2.0 的支持(参见原文 accouncement)。

您的第一个错误是由于 ASP.NET Core 2.0 与 .NET Core 1.1 不兼容。正如您尝试做的那样,您需要为此定位 .NET Core 2.0 (netcoreapp2.0)。正如我上面提到的,升级到 Visual Studio 2017 版本 15.3 将使您能够做到这一点。

您的第二个错误是由于 Entity Framework 6.1.3 与 .NET Core 1.1(或者,事实上,任何版本的 .NET Core)不兼容。为了在 .NET Core 项目中使用 Entity Framework,您需要使用 Entity Framework Core (nuget)。这是 Entity Framework 的全新版本,因此请务必查看 differences如果您还没有。

关于c# - 无法创建 asp net core 2.0 web api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46268073/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com