How to create .Net 5.0 Class Library project in Visual Studio 2019 16.8.1?
In Visual Studio 2019, I believe it needs to be 16.8+, you can enable the preview feature
Show all .NET Core templates in the New project dialog.
Go Tools -> Options -> Environment -> Preview Features -> Show all .NET Core templates in the New project dialog (Requires Restart)
Then close Visual Studio and reopen it. Now from the new project dialog there should be a
Class Library with a C# in the tags.
From here, click
Next. Fill out where you want it to be made and what to call it as you normally would.
Next again. This will bring you to a new screen that has a drop down for the
Set this to
.NET 5.0 and click
Create. This creates a .NET 5.0 class library and opens it in the IDE.
If the project templates are still giving you .NET Core 3.1 as the highest option, and the project properties options aren't allowing what you want - it isn't a problem: simply right-click on the project in Solution Explorer and select "Edit Project File", to edit the .csproj, and you can change the target framework - for example, from
to target .NET 5, or
You can try the following steps to create a Class Library project based on .NET 5.0.
First, please download the .NET 5.0 SDK from Download .NET 5.0 and install it.
Second, please use the following command to create the project.
dotnet new Classlib -n Testlib
Third, please find the specific path and open the project
Finally, you can see a class library based on .NET 5.0.