2017-03-01 89 views
1

心中已经创建了一个Web应用程序与网络核心,以项目添加类库与网络核心的Web应用程序

"frameworks": { 
    "net461": { 
     "dependencies": { 
     "Core": { 
      "target": "project" 
     } 
     } 
    }  
    }, 

然后我装箱一个类库核心网与该项目

"dependencies": { 
    "NETStandard.Library": "1.6.0" 
    }, 

    "frameworks": { 
    "netstandard1.6": { 
     "imports": "dnxcore50" 
    } 
    } 

,但是当我尝试添加类项目的Web应用程序,VS2015告诉我

The following project are not supported as reference. 
WebApplication: 
.NETFramework, Version=v4.6.1 
ClassLibrary: 
.NETStandard, Version=v1.6 

如何添加类librar ❖主项目?

+2

使用类库参考(包) – brykneval

回答

0

如果你想针对.NET框架4.6.1,您的类库必须.NET标准1.4或走低建议在官方文档 - How to target the .NET Standard

1)创建.NET核心类库。 project.json看起来像这 -

{ 
    "version": "1.0.0-*", 

    "dependencies": { 
    "NETStandard.Library": "1.6.0" 
    }, 

    "frameworks": { 
    "netstandard1.4": { 
     "imports": "dnxcore50" 
    } 
    } 
} 

2)在ASP.NET核心应用(.NET框架),它可以像如下─

"frameworks": { 
    "net461": { 
     "dependencies": { 
     "ClassLibrary1": { 
      "target": "project" 
     } 
     } 
    }  
    }, 
0

您必须将您的项目作为dotnetcore项目启动(请参阅下图),因为它似乎希望将框架4.6文件添加到您的dotnetcore应用程序中。

dotnetcore project

有关dotnetcore更多信息compatibulity检查这篇文章 Compatibility between dotnetcore and framework 4.5

相关问题