What are the differences between Class Library
& ASP.NETvNext Class Library
projects? From project creation in VS 14 CTP
, it seems like class library hasn't changed at all whereas 'ASP.NETvNext Class Library' includes the new project.json file. However, it's not clear whether it has any benefits related to ASP.NETvNext or not?
This link says that compilation is dynamic for this ASP.NETvNext library project. Is there any other differences between the two of them?
Differences between a Class and an Interface:An Interface cannot be instantiated i.e, objects cannot be created. Classes does not support multiple inheritance. Interface supports multiple inheritance. It can be inherit another class.
In object-oriented programming , a class library is a collection of prewritten class es or coded templates, any of which can be specified and used by a programmer when developing an application program.
A class library defines types and methods that are called by an application.
The class defines object's internal state and the implementation of its operations. In contrast, an object's type only refers to its interface - a set of requests to which it can respond. An object can have many types, and objects of different classes can have the same type.
Another advantage are that the vNext projects output nuget-packages on build, while pre-vNext class libraries only output DLLs. If you specify multiple target frameworks in your project.json file the nuget-package from building will contain a DLL built for all of these target frameworks.
As an example here is a project.json:
{
"dependencies": {
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
"System.Linq": "4.0.0.0",
},
"frameworks": {
"net45": {},
"aspnetcore50": {}
}
}
If you run the "kpm build" command from the class libraries project folder it will output a nuget-package containing the following files.
lib/aspnetcore50/ProjectName.dll
lib/aspnetcore50/ProjectName.xml
lib/net45/ProjectName.dll
lib/net45/ProjectName.xml
When you reference this class library from other projects it will use the correct DLL depending on the target framework it requires.
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