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.
Error Message
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).
dotnet new <TEMPLATE> - .NET CLI The dotnet new command creates new . NET projects based on the specified template.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With