2016-03-08 37 views
0

基本上上面的问题,我将如何去添加对两个项目,库和服务,这两个目标是DNXcore50类库的引用。他们也提到.net framework 4.5.1。我得到了库相互交流,并可以从基于Web的api /应用程序调用它们,但是当我尝试将服务层引用添加到UWP应用程序时,我收到一条错误消息,指出“无法引用servicelayer”。UWP使用存储库和服务的单独项目,但不能添加对应用程序的引用

下面是两个资源库和服务层的project.json文件

库:

{ 
    "version": "1.0.0-*", 
    "description": "Testing.Data Class Library", 
    "authors": [ "" ], 
    "tags": [ "" ], 
    "projectUrl": "", 
    "licenseUrl": "", 

    "dependencies": { 
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", 
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", 
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", 
    "EntityFramework.MicrosoftSqlServer.Design": "7.0.0-rc1-final", 
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", 
    "EntityFramework.Commands": "7.0.0-rc1-final" 
    }, 
    "commands": { 
    "web": "Microsoft.AspNet.Server.Kestrel", 
    "ef": "EntityFramework.Commands" 
    }, 

    "frameworks": { 
    "net451": { }, 
    "dnxcore50": { } 
    } 
} 

层和服务层:

{ 
    "version": "1.0.0-*", 
    "compilationOptions": { 
    "emitEntryPoint": true 
    }, 

    "dependencies": { 
    "AutoMapper": "4.2.0", 
    "Testing.Data": "1.0.0-*", 
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", 

    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final" 

    }, 

    "commands": { 
    "web": "Microsoft.AspNet.Server.Kestrel" 
    }, 

    "frameworks": { 
    "dnx451": { }, 
    "dnxcore50": { } 
    }, 

    "exclude": [ 
    "wwwroot", 
    "node_modules" 
    ], 
    "publishExclude": [ 
    "**.user", 
    "**.vspscc" 
    ] 
} 

我已经尝试设置这两个项目输出一个DLL并将它们复制到应用程序的目录中,但Visual Studio仍然拒绝选择该目录。

+0

为什么您的服务层声明为应用程序? – Tseng

+0

我想我改变了它,因为我无法让服务层引用存储库类库。让我看看我能在这里真正快速地工作。它也是如此,我将能够承载服务器上的服务层 – tscLegend

回答

1

你的服务层目标框架名字对象(TFM)似乎是错误的。 dnx451dnxcore50用于应用程序(即ASP.NET web项目或单元测试项目)。

对于类库,您必须使用net451dotnet5.4(现在,将随新RC一起再次更改)。

请参阅this announcement ASP.NET 5/Core RC1。

+0

我想补充说,即使不是这种情况,所需的依赖与UWP不兼容。 “EntityFramework.MicrosoftSqlServer.Design”:“7.0.0-rc1-final” “EntityFramework.MicrosoftSqlServer”:“7.0.0-rc1-final” “EntityFramework.Commands”:“7.0.0 -rc1-final“ – Barptad

+0

你是说你不能在UWP中使用实体框架。 – tscLegend

+0

那么根据网络标准平台(https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md)UWP是netstandard 1.3(这等于'dotnet5.4'为dotnet monikers总是关闭1,所以'dotnet5.1' = netstandard 1.0)。所以为UWP创建的包('dotnet5.4')应该也可以在ASP.NET Core中使用。从同一链接中,您还可以看到UAP的目标名称:“uap10”和/或“netcore50”。请注意,当前的静音是指当前未发布的RC2版本,并且netstandard'名字对象在dnx/rc1 – Tseng

相关问题