Blake Rivell
Blake Rivell

Reputation: 13875

Unable to find and add an ASP.NET 5 Class Library project to a solution

I recently created a new ASP.NET 5 Web App and a standard C# Class Library only to find out that the ASP.NET 5 Web App can't reference. I did research and saw that there is an ASP.NET 5 Class Library but can't find it anywhere in my fully updated VS2015 Enterprise.

Is it called Class Library (Package) or Class Library (Portable)?

Upvotes: 2

Views: 1079

Answers (1)

tugberk
tugberk

Reputation: 58484

Yes, Class Library (Package). In fact, you can just add a project.json file with the minimum content and reference that add it to your solution by right clicking on your solution and selecting Add > Existing project....

enter image description here

VS will create xproj file as soon as you reference it (which is only needed for VS). Then, you can reference it like below:

{
    "version": "1.0.0",
    "dependencies": {
        "3-class-lib": ""
    },
    "frameworks": {
        "dnx451": {},
        "dnxcore50": {
            "dependencies": {
                "System.Console": "4.0.0-beta-23516"
            }
        }
    }
}

In this case, the 3-class-lib is the name of the class library folder which ends up being the name. You can refer to this for this sample.

Upvotes: 3

Related Questions