At a minimum you'll need a .csproj
file with this content:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
That is assuming you'll be targeting netstandard2.0 which would allow your library to run on .NET Framework 4.6.1, .NET Core 2.0 and any other runtime that implements the standard.
And also have downloaded the .NET Core 2.0 SDK.
Unlike the old csproj
, there's no need to add the individual .cs
files to compile them.
So on a directory with such content:
- Class1.cs
- Class2.cs
- Project.csproj (with the content mentioned above)
Simply running: dotnet build
will output a dll
at the bin folder as you'd expect.
It's worth mentioning that the .NET Core CLI have templates for ASP.NET Core, class library, xUnit test project, etc:
$ dotnet new classlib
Would give you the csproj
and a first class file.