[英]Can not create classlib (core) using dotnet CLI
I used the dotnet CLI command dotnet new classlib -o ProjectName
to create a class library and added the EF Core Package using dotnet add package
but when I tried to run some dotnet ef
commands it threw the following error. 我使用dotnet CLI命令
dotnet new classlib -o ProjectName
创建一个类库,并使用dotnet add package
添加了EF Core Package,但是当我尝试运行一些dotnet ef
命令时,它引发了以下错误。
Later, I realized that dotnet new classlib
creates classlib (.netstandard) instead of creating classlib (core) . 后来,我意识到
dotnet new classlib
创建了classlib(.netstandard)而不是创建classlib(core) 。 I would like to know is there anyway to create classlib (core) using dotnet CLI or any alternate for classlib (core) . 我想知道,反正是有创建使用的dotnet CLI或CLASSLIB(核心)任何替代CLASSLIB(核心)。
You can always use -h
to check the class lib. 您始终可以使用
-h
来检查类lib。 So, when you run dotnet new classlib -h
, you would find an option -f
to set the framework. 因此,当您运行
dotnet new classlib -h
,您会找到一个选项-f
来设置框架。 Basically, you can run the following if you would like to create a new .net core project: 基本上,如果要创建新的.net核心项目,可以运行以下命令:
dotnet new classlib -f netcoreapp2.2
However, since version 2.2 is just a couple of days old, you might either want to install it or use dotnet new classlib -f netcoreapp2.1
. 但是,由于2.2版只有几天的历史,您可能要么安装它,要么使用
dotnet new classlib -f netcoreapp2.1
。
You can also convert your existing netstandard app to .net core by updating the .csproj file. 您还可以通过更新.csproj文件将现有的netstandard应用程序转换为.net核心。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.