Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference Between Class Library & ASP.NETvNext Class Library?

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?

like image 949
Ali Avatar asked Sep 10 '14 12:09

Ali


People also ask

What is the main difference between library interface and class?

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.

What is class library and example?

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.

What is called class library?

A class library defines types and methods that are called by an application.

What is the difference between types and classes?

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.


1 Answers

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.

like image 127
AndersNS Avatar answered Sep 30 '22 15:09

AndersNS