简体   繁体   English

project.json解决方案项目参考

[英]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. 我正在玩ASP.NET 5(vNext),我想将project.json文件的引用添加到我的数据库项目中。 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 . DataManagement项目只是类库 ,但我尝试使用ASP.NET 5类库 Both project types fail and this is what I see in visual studio: 两种项目类型都失败了,这就是我在visual studio中看到的:

解决方案视图

Project is building properly and producing (of course) Datamanagement.dll, but this library isn't found by Web project. 项目正在正确构建并生成(当然)Datamanagement.dll,但Web项目找不到此库。

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

By default, both projects need to have the same parent folder. 默认情况下,两个项目都需要具有相同的父文件夹。

For example, this pattern works: 例如,这种模式有效:

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

But this won't: 但这不会:

  • /mysolution/sub1/project1/project.json /mysolution/sub1/project1/project.json
  • /mysolution/sub2/project2/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: 但是,如果他们不能,您可以将global.json文件添加到“solution”文件夹并指明源位于何处:

{
    "sources": ["sub1", "sub2"]
}

You have to specify a version. 您必须指定一个版本。 Try: 尝试:

"DataManagement": "1.0.0-*"    

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM