I'm trying to figure out what an "ASP.NET 5 Class Library" (vNext) C# project has to do with ASP.NET. Why create a project with this template rather than just a regular C# "Class Library" project?
I like the new features, such as project.json file rather than .csproj file etc, but it doesn't seem right to create an "ASP.NET" class library when the project has nothing to do with ASP.NET or IIS etc. It's just a project for the business logic layer. A new WebApi ASP.NET web site will eventually reference this project, but that's not relevant at this point.
Is it just badly named? Should it just be called "vNext Class Library" and not use an icon that looks like a web app?
Class libraries are the shared library concept for . NET. They enable you to componentize useful functionality into modules that can be used by multiple applications. They can also be used as a means of loading functionality that is not needed or not known at application startup.
When should we use one over the other? The decision is a trade-off between compatibility and API access. Use a . NET Standard library when you want to increase the number of applications that will be compatible with your library, and you are okay with a decrease in the .
Base Class Libraries The . NET Framework Base Class Libraries is a library of classes, interfaces, and value types that provide access to system functionality. We can say that it is the foundation of the . NET Framework on which the applications, controls, and components of the .
There are a number of benefits of ASP.NET 5 Class Library projects (.kproj) over Class Library projects (.csproj):
aspnet50
, aspnetcore50
, net45
, and various other portable class library variations. This includes rich Visual Studio support for Intellisense to notify you which APIs are available for which targets.You can reference a *.csproj project from a *.kproj project (this was just made a lot easier with the new preview of Visual Studio 2015), but it was always possible with some manual steps.
As far as the names goes, it's a relic of history that will soon be addressed. The new project type is useful far beyond ASP.NET 5 applications. Expect to see new names in a future preview of Visual Studio:
With the release of Visual Studio 2015 RC you can see the updated project template names:
These use the project.json
file and the .NET Execution Environment (DNX) to build, run, and package (into a NuGet package) the project.
These project templates continue to show up in the New Project dialog under the "Web" node, but now also show up in the main "Visual C#" node as well.
This is an interesting observation, the current template will generate a class library compatible with ASP.NET 5 runtime. You don't get that from the normal C# class library.
I filed the following issue for tracking this design question - https://github.com/aspnet/Home/issues/281
From what I understand one benefit is that the end product of ASP.NET 5 Class Library project is a NuGet package (rather than just the .dll assembly).
You can generate the NuGet package by right clicking the project in Visual Studio 2015 and choosing the "Publish..." option. Or you can use "KPM pack" at the command line.
Also, you have the ability to use the ASP.NET 5 Core runtime so that your library can run cross-platform .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With