Search code examples
c#class-library.net-core.net-core-rc2dotnet-cli

How to scaffold a Class Library targeting .NET Core?


I know that using Visual Studio there is a template to create a Class Library targeting .NET Core, but I'm looking for a way to do it from the command line.

I know that using dotnet new you can create a new .NET core project, but it is a console application that has a few more dependencies than the class library created by Visual Studio. Is there a command or way to create a class library project from the command line?

Eg: enter image description here


Solution

  • dotnet new now supports arguments one of them is --type -t where you can specify: console, web, lib and xunittest.

    So now you can do:

    dotnet new --type lib

    Source: https://learn.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-new