我有四個庫項目都是針對netstandard1.5
框架。其中一些取決於另一個,智能感知在這四個項目下運行良好。如何在Visual Studio 2015中修復引用netstandard1.5庫項目的智能感知?
我想在我的ASP.NET netcoreapp1.0
項目中使用這些庫。但是當我瞄準netcoreapp1.0
框架時,找不到類型(在visual studio中概述爲紅色)。項目編譯器成功編譯並運行。
只要我切換到我的web api中的netstandard1.5
框架,庫的類型被識別,我得到intellisense。
任何想法如何解決這個問題或我做錯了什麼?
這裏是project.json
的庫項目之一(他們幾乎是相同的):
{
"version": "1.0.0-*",
"frameworks": {
"netstandard1.5": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Security.Principal": "4.0.1-rc2-24027"
}
}
},
"dependencies": {
"Microsoft.AspNetCore.Identity": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"HoehenSucht.Models": "1.0.0-*",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027"
}
}
這裏是API的project.json
:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"HoehenSucht.Framework": "1.0.0-*",
"HoehenSucht.Models": "1.0.0-*",
"HoehenSucht.Repositories": "1.0.0-*",
"HoehenSucht.Services": "1.0.0-*",
"HoehenSucht.Authentication": "1.0.0-*",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Autofac.Extensions.DependencyInjection": "4.0.0-rc2-240",
"AutoMapper": "4.2.1",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
"System.Security.Principal": "4.0.1-rc2-24027",
"System.Reflection": "4.1.0-rc2-24027",
"IdentityServer4.AccessTokenValidation": "1.0.0-beta6",
"Microsoft.AspNetCore.Authorization": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Hosting": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final",
"Autofac": "4.0.0-rc2-240",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final",
"HoehenSucht.API.Models": "1.0.0-*",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"System.Linq": "4.1.0-rc2-24027",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"System.Linq.Parallel": "4.0.1-rc2-24027",
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-*"
},
"System.Collections": "4.0.11-rc2-24027",
},
"imports": [ "dnxcore50", "portable-net45+win8" ]
}
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
}
}
在更改框架後是否還原了包? – svick
我不知道多頻繁重複一次,但不要混用RC1和RC2軟件包! '「Microsoft.VisualStudio.Web.BrowserLink.Loader」:「14.0.0-rc1-final」' – Tseng
我刪除了包但仍然得到相同的「錯誤」。之後也做了一次乾淨的重建。 也在解決方案根目錄和項目根目錄中執行了'dotnet restore'。 – Silthus