Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Project Reference in asp.net 5 application

As per my knowledge, Visual Studio 2015 has some update and we can't add DLLs in asp.net 5 application any more, if we need to add then we need to make NuGet package and then install it.

Now my Questions are:-

1) If I have one project with two class libraries then how can i add that class library's reference (DLL) in my asp.net 5 application?

2) If a class library is also in development mode then how to update that DLL in asp.net 5 application if that DLL install via NuGet, because every time for publish on NuGet and get latest take more time.

3) Suppose if we need to add all DLLs using NuGet then what about private DLLs?

4) Is there any way without NuGet package manager to handle this?

like image 848
Vinit Patel Avatar asked Jun 05 '15 11:06

Vinit Patel


1 Answers

Quick answer - you don't need NuGet packages for that and yes, it's possible to refer your own libs.

Two ways:

  1. By adding it into root level "dependecies" object in your project.json. Be aware that this action will add reference into every target framework listed in the "frameworks" section, therefore if you adding reference to the old-type class library it would not work with new DNXCore 5.0

    {
       "webroot": "wwwroot",
       "version": "1.0.0-*",
    
       "dependencies": {
           "Library": "1.0.0-*" 
    
  2. By adding it for specific framework version. Which is more flexible as you can use old-type libs for DNX451 and new vNext Class Libraries for DNXCore 5.0

    "frameworks": {
        "dnx451": {
            "dependencies": {
                "ClassicLib": "1.0.0-*",
                "vNextLib": "1.0.0-*",
            }
        },
        "dnxcore50" : {
            "dependencies": {
                "vNextLib": "1.0.0-*"
            }
        }
     } ....
    

All samples I've checked on Visual Studio 2015 RC.

like image 144
Andriy Horen Avatar answered Sep 28 '22 03:09

Andriy Horen