Reputation: 1409
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?
Upvotes: 5
Views: 1668
Reputation: 1607
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.
Upvotes: 7