简体   繁体   English

无法使用dotnet CLI创建classlib(核心)

[英]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命令时,它引发了以下错误。

Error Message 错误信息

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.

相关问题 .NET CLI 'dotnet new classlib' 命令不支持 5 个特定于操作系统的 TFM - .NET 5 OS-specific TFMs not supported by CLI 'dotnet new classlib' command 我可以使用Microsoft Dotnet CLI构建ASP.NET Core Web应用程序吗? - Can I build ASP.NET Core web application using Microsoft Dotnet CLI? 是否可以为 dotnet 核心运行时安装 DotNet 核心 CLI? - Is it possible to install DotNet core CLI for dotnet core runtime? 如何使用 dotnet cli 创建 .NET 5 版本的 webapi? - How could I create a webapi of the .NET 5 version using the dotnet cli? dotnet cli 如何使用以前的 sdk/framework 创建项目? - dotnet cli how to create project using previous sdk/framework? 通过 DotNet CLI 创建以 .NET 框架为目标的新 ASP.NET 核心项目 - Create new ASP.NET Core project that targets .NET Framework by DotNet CLI 如何在.NET Core 2 classlib项目中使用C#从.csproj文件读取/获取PropertyGroup值? - How to read/get a PropertyGroup value from a .csproj file using C# in a .NET Core 2 classlib project? 将 FileStream 与 dotnet 核心一起使用 - Using FileStream with dotnet core CLI“ dotnet ef”不适用于全新的dotnet核心Web项目 - CLI “dotnet ef” is not working for a brand new dotnet core web project 如何使用c#代码创建dotnet核心项目? - How to create dotnet core project using c# code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM