在asp.net 5.0 project.json RavenDB.Client引用问题 [英] Problems with RavenDB.Client reference in asp.net 5.0 project.json

查看:140
本文介绍了在asp.net 5.0 project.json RavenDB.Client引用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个与RavenApiController新的ASP.NET 5.0(又名Asp.Net vNext)的东西,似乎无法得到RavenDB.Client引用在所有的工作。

I'm trying to build a RavenApiController with the new ASP.NET 5.0 (aka Asp.Net vNext) stuff and can't seem to get the RavenDB.Client references to work at all.

我得到的错误是

错误CS0246类型或命名空间名称'乌鸦'找不到(是否缺少using指令或程序集引用?)SharedIO.ASP.NET核心5.0 RavenApiController.cs 3

我project.json如下:

My project.json is as follows

{
"webroot": "wwwroot",
"version": "1.0.0-*",
"exclude": [
    "wwwroot"
],
"packExclude": [
    "**.kproj",
    "**.user",
    "**.vspscc"
],
"dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta2",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta2",
    "Microsoft.AspNet.Mvc": "6.0.0-beta2",
    "RavenDB.Client": "3.0.3599",
    "SharedIOModel": "1.0.0-*"
},
"frameworks": {
    "aspnet50": {},
    "aspnetcore50": {}
}

}

从而未能建立在第三行用于RavenApiController.cs的代码开始为:

The code for RavenApiController.cs which fails to build on the third line begins as:

    using System;
    using Microsoft.AspNet.Mvc;
    using Raven.Client;
    using Raven.Client.Document;;

    namespace SharedIO.Controllers
    {
        [RequireHttps]
        public abstract class RavenAPIController : Controller
        {
            public IDocumentStore Store
            {
                get { return LazyDocStore.Value; }
            }



完全难住了。

Totally stumped.

有关它的价值的智能感知似乎能够找到参考就好了,直到我真正'打造解决方案,我没有得到一个错误。

For what it's worth intellisense seems to be able to find the reference just fine and I don't get an error until I actually 'build solution.

智能感知也让我发现,(例如)Raven.Client.Document.IDocumentStore是ASP.NET 5.0可用,但不可用的ASP.NET核心5.0'。

Also Intellisense shows me that (for example) Raven.Client.Document.IDocumentStore is 'Available' in ASP.NET 5.0 but 'Not Available' in 'ASP.NET Core 5.0'.

推荐答案

的问题是,你引用 RavenDB.Client project.json 顶级依赖节点。这意味着,这些依赖,都适用于桌面CLR( aspnet50 )和CoreCLR( aspnetcore50 )。

The problem is that you referencing RavenDB.Client in the top level dependencies node in project.json. That means that those dependencies are applicable to both Desktop CLR (aspnet50) and CoreCLR (aspnetcore50).

当你构建一个ASPNET 5项目,所有的配置都是建立,不只是活动之一。晴确保 RavenDB.Client 仅适用于桌面CLR使移动它的配置下,依赖节点下。

When you build an ASPNET 5 project, all configurations are built, not just the "active" one. Mostly sure RavenDB.Client works only with the Desktop CLR so move it under a dependencies node under that configuration.

"dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta2",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta2",
    "Microsoft.AspNet.Mvc": "6.0.0-beta2",
    "SharedIOModel": "1.0.0-*"
},
"frameworks": {
    "aspnet50": {
        "dependencies" : {
            "RavenDB.Client": "3.0.3599",
        }
    },
    "aspnetcore50": {}
}

这时,你可能不得不或者使用一些有条件的块在代码中(#如果ASPNET50 ),或删除所有CoreCLR一起。

Then you might have to either use some conditional blocks in your code (#if ASPNET50) or remove CoreCLR all together.

这篇关于在asp.net 5.0 project.json RavenDB.Client引用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆