升级NetStandard 2.0级库升至Dotnet 6

发布于 2025-01-31 09:14:35 字数 441 浏览 1 评论 0 原文

我正在将 dotnet core 3.1 Web应用程序升级到 dotnet core 6 当然包括此更改:

- <TargetFramework>netcoreapp3.1</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>

现在,使用类库,我还应该替换 NetStandard 也参考?例如:

- <TargetFramework>netstandard2.1</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>

I am upgrading a dotnet core 3.1 web app to dotnet core 6 which, of course, includes this change:

- <TargetFramework>netcoreapp3.1</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>

Now, with the class libraries, should I also replace the netstandard reference, too? Eg:

- <TargetFramework>netstandard2.1</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

木有鱼丸 2025-02-07 09:14:35
- <TargetFramework>netstandard2.1</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>

这对我的作用。
当Xinlin回答时,只需更改它,然后相应地更新Nuget软件包。

我关心的改变是因为我已经从主应用程序(NetCore)中使用了dbcontext。通过保持 NetStandard2.1 使其无法获得DBContext(也许是因为它使用了不同的EFCORE版本,CMIIW)

- <TargetFramework>netstandard2.1</TargetFramework>
+ <TargetFramework>net6.0</TargetFramework>

That works on mine.
As Xinlin answer, just change it then update the nuget packages accordingly.

As my concern changing it was because I've to use dbcontext from the main app (netcore). By keeping it netstandard2.1 makes it fail to get the dbcontext (maybe because it uses different EFCore version, CMIIW)

依 靠 2025-02-07 09:14:35

我刚刚完成了我的项目的迁移.NET标准库2.1至.NET 6。

  1. 更改项目文件中的代码。将目标框架更改为Net6.0
  2. 更新项目中的所有Nuget软件包,以匹配.NET Core 6版本。

I just completed migrating .NET Standard Library 2.1 to .NET 6 for my project.

  1. Changing this line of code in the project file. Change the target framework to net6.0
  2. Update all Nuget packages in the project to match the .Net Core 6 version.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文