如何在新创建的.NET Core 2.0 Web应用程序中定位.NET Standard 2.0?

问题描述:

我刚刚使用 dotnet新网络创建了一个新项目。我的Google-foo可能无法让我失望,但我没有找到与答案有关的任何内容(如果我错过了明显的内容,请链接到另一个SO答案或相关文档)。

I've just created a fresh project using dotnet new web. My Google-foo may be failing me, but I didn't find anything relating to my answer (please link to another SO answer, or relevant documentation if I've missed something obvious).

如果我要确保此新项目符合.NET Standard 2.0,我现在该怎么办?

If I want to ensure this new project is .NET Standard 2.0 compliant, what do I now do?

NET Standard用于类库。应用程序必须针对netcoreapp *,其中*是版本号。下面显示了兼容性矩阵: https://docs.microsoft.com/ zh-cn / dotnet / standard / net-standard

NET Standard is for class libraries. Applications must target netcoreapp* where * is a version number. The following shows the compatibility matrix: https://docs.microsoft.com/en-us/dotnet/standard/net-standard

例如,.NET Core 2可以使用.NET Standard版本2和更低版本。

For example, .NET Core 2 can consume .NET Standard version 2 and below.