可ASP.NET vNext使用非vNext参考? [英] Can ASP.NET vNext use non-vNext references?

查看:223
本文介绍了可ASP.NET vNext使用非vNext参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在VS 14 CTP一个ASP .NET vNext项目。我针对的.NET Framework 4.5.1。我添加了一个引用的NuGet包,并没有一个具体的构建为vNext。

So I have a ASP .NET vNext project in VS 14 CTP. I am targeting .NET Framework 4.5.1. I added a reference to a NuGet package, which does not have a build specific for vNext.

现在Visual Studio显示了包在编辑器/智能感知没有错误用法。但是,编译时,我得到命名空间MyPackage的未找到的错误。

Visual Studio now shows usages of the package with no errors in the editor / Intellisense. But when compiling, I get "The namespace 'MyPackage' not found" errors.

这是我的理解,我可以添加引用的.NET Framework程序集,只要我针对现有的.NET Framework 4.5.1。这是不是这样的?我能解决这个问题?

It was my understanding that I can add references to .NET Framework assemblies as long as I target the existing .NET Framework 4.5.1. Is this not the case ? Can I resolve this error ?

推荐答案

如果您有K10和project.json上市net451框架,VS 14在默认情况下建立针对这两个框架的项目。在如果任何组件都没有专为K10架构这样的情况下,构建失败,包没有发现错误。所以网451包应该特别是在project.json的net451部分加入。我只是贴在那里Microsoft.Bcl软件被列为net451第一个例子project.json

If you have both k10 and net451 frameworks listed in project.json, VS 14 by default builds project against both frameworks. In such case if any of the assemblies are not built for k10 framework, build fails with package not found error. So net 451 packages should specifically be added in net451 section of project.json. I am just pasting an example project.json where Microsoft.Bcl package is listed in net451 section

{
"dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-*",
    "Microsoft.AspNet.Mvc": "6.0.0-*"
    <more packages>
},
"configurations": {
    "net451": {
        "dependencies": {
            "Microsoft.Bcl": "1.1.9"
            }        
  }
 }
}

这篇关于可ASP.NET vNext使用非vNext参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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