如何在新创建的 .NET Core 2.0 Web 应用程序中以 .NET Standard 2.0 为目标? [英] How do I target .NET Standard 2.0 in a freshly created .NET Core 2.0 web app?
问题描述
我刚刚使用 dotnet new web
创建了一个新项目.我的 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/en-us/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.
这篇关于如何在新创建的 .NET Core 2.0 Web 应用程序中以 .NET Standard 2.0 为目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!