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.
Later, I realized that dotnet new classlib
creates classlib (.netstandard) instead of creating classlib (core). I would like to know is there anyway to create classlib (core) using dotnet CLI or any alternate for classlib (core).
You can always use -h
to check the class lib. So, when you run dotnet new classlib -h
, you would find an option -f
to set the framework. Basically, you can run the following if you would like to create a new .net core project:
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
.
You can also convert your existing netstandard app to .net core by updating the .csproj file.