Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

project.json solution project reference

I'm playing with ASP.NET 5 (vNext) and I wanted add reference to project.json file to my Database Project. Here it is:

project.json

{
    "webroot": "wwwroot",
    "version": "1.0.0-*",
    "exclude": [
        "wwwroot"
    ],
    "packExclude": [
        "**.kproj",
        "**.user",
        "**.vspscc"
    ],
    "dependencies": {
        "Microsoft.AspNet.Server.IIS": "1.0.0-beta1",
        "EntityFramework.Commands": "7.0.0-beta1",
        "EntityFramework": "7.0.0-beta1",
        "EntityFramework.SqlServer": "7.0.0-beta1",
        "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta1",
        "Microsoft.AspNet.Security.Cookies": "1.0.0-beta1",
        "DataManagement": ""    <----- THIS IS MY PROJECT WITHIN SOLUTION
    },
    "frameworks": {
        "aspnet50": { },
        "aspnetcore50": { }
    }
}

DataManagement project is simply Class Library, however I tried with ASP.NET 5 Class Library. Both project types fail and this is what I see in visual studio:

Solution View

Project is building properly and producing (of course) Datamanagement.dll, but this library isn't found by Web project.

To be exact, below there are target versions of both projects:

DataManagement: KRE-CLR-x86.1.0.0-rc1-10846
Web:            KRE-CLR-x86.1.0.0-rc1-10846
like image 374
Fka Avatar asked Mar 09 '15 18:03

Fka


People also ask

Where does project assets json come from?

json file is generated in the process of restoring the NuGet packages in projects that use project. json . It holds a snapshot of all the information that is generated as NuGet walks the graph of packages and includes the version, contents, and dependencies of all the packages in your project.

What is project json?

Project. json is an automatically generated file which is included in the folder of each automation project made in Studio. The file holds information about the project dependencies, and web services loaded in libraries.

What is package reference in Csproj?

Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to having a separate packages. config file. Use of PackageReference doesn't affect other aspects of NuGet; for example, settings in NuGet.


1 Answers

By default, both projects need to have the same parent folder.

For example, this pattern works:

  • /mysolution/project1/project.json
  • /mysolution/project2/project.json

But this won't:

  • /mysolution/sub1/project1/project.json
  • /mysolution/sub2/project2/project.json

Often the easiest is to ensure both projects have the same common parent folder.

But, if they can't, you can add a global.json file to the "solution" folder and indicate where the sources are to be located:

{
    "sources": ["sub1", "sub2"]
}
like image 134
Eilon Avatar answered Oct 06 '22 05:10

Eilon