Click here to Skip to main content
15,886,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an ASP.NET application that targets .NET Framework 4.7.2. I want to add a class library to it. When I try this, the only project-type option I see that looks anything like what I want is a Razor Class Library. If I choose this, the only choices for .NET are Core 3.1, Core 2.1 and , .NET5 (current).

If I choose the last one, it builds but includes some stuff that seems to be aimed at getting one version of .NET to work with another (e.g. Microsoft.AspNetCore.Components.Web).

What I have tried:

The only other option is to create the library as an ASP.NET Web Application, which does allow me to choose .NET 4.7.2, to match the main project, but it seems wrong to create a whole web application when all I want is a library.

What is the right way to create a POCO library for an ASP.NET application?

(Note: I'd like to make the move to .NET Core as this is a new application but this is not currently supported by my web provider.)
Posted
Updated 17-Mar-21 5:46am

If you search the templates list in the "new project" dialog, you should have "Class library". Ignore the Razor, Windows Forms, WPF, etc. options. There will be at least two options which are simply "Class library": one which targets .NET Framework, and one which targets .NET Standard or .NET Core.

Personally, I'd go with the version that targets .NET Standard or .NET Core, and pick ".NET Standard 2.0" as the target. You can always switch to .NET 4.7.2 later if required.
 
Share this answer
 
Probably because you don't have enough practice at it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900