Home Quickstart for Creating a Library Using the .NET Core CLI
Post
Cancel

Quickstart for Creating a Library Using the .NET Core CLI

The .NET Core CLI enables quickly scaffolding a new library. Here’s a quickstart of commands to use, substituting My.Sample.Project for your own new project:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
> dotnet new --update-apply
> mkdir My.Sample.Project
> cd My.Sample.Project
> dotnet new sln
> mkdir src
> cd src
> mkdir My.Sample.Project
> cd My.Sample.Project
> dotnet new classlib
> cd ../..
> mkdir tests
> cd tests
> mkdir My.Sample.Project.Tests
> cd My.Sample.Project.Tests
> dotnet new xunit
> dotnet add reference ../../src/My.Sample.Project/My.Sample.Project.csproj
> cd ../..
> dotnet sln add ./src/My.Sample.Project/My.Sample.Project.csproj
> dotnet sln add ./tests/My.Sample.Project.Tests/My.Sample.Project.Tests.csproj

It’s all setup with a test project to begin your new library!

Consider adding a build script for continuous integration, .gitignore, .editorconfig, LICENSE, and a README.md too!

This post is licensed under CC BY 4.0 by the author.

Using SQL Server LocalDB with Travis CI Windows Builds

Coding To Support Both .NET Full Framework and .NET Core

Comments powered by Disqus.