我使用net461
引用運行ASP.NET 1.0的核心完整的應用程序。現在我試圖添加另一個框架 - netcoreapp1.0
。對於這一點,我已經更新了我的project.json這樣的:解決錯誤「Microsoft.NETCore.App 1.0.0不支持框架.NETFramework,版本= v4.6.1」
{
"userSecretsId":"",
"version":"2.4.0-*",
"buildOptions":{
"emitEntryPoint":true,
"preserveCompilationContext":true
},
"dependencies":{
"Microsoft.ApplicationInsights.AspNetCore":"1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies":"1.0.0",
"Microsoft.AspNetCore.Diagnostics":"1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore":"1.0.0",
"Microsoft.AspNetCore.Identity":"1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore":"1.0.0",
"Microsoft.AspNetCore.Mvc":"1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers":"1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration":"1.0.0",
"Microsoft.AspNetCore.Server.Kestrel":"1.0.0",
"Microsoft.AspNetCore.StaticFiles":"1.0.0",
"Microsoft.EntityFrameworkCore":"1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer":"1.0.0",
"Microsoft.Extensions.Configuration.CommandLine":"1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions":"1.0.0",
"Microsoft.Extensions.Configuration.Json":"1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets":"1.0.0",
"Microsoft.Extensions.Logging":"1.0.0",
"Microsoft.Extensions.Logging.Console":"1.0.0",
"Microsoft.Extensions.Logging.Debug":"1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader":"14.0.0",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc":"1.0.0-preview2-final"
},
"tools":{
"BundlerMinifier.Core":"2.0.238",
"Microsoft.AspNetCore.Razor.Tools":"1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools":"1.0.0-preview2-final",
"Microsoft.Extensions.SecretManager.Tools":"1.0.0-preview2-final"
},
"commands":{
"ef":"EntityFramework.Commands",
"web":"Microsoft.AspNetCore.Server.Kestrel"
},
"frameworks":{
"net461":{
},
"netcoreapp1.0":{
"imports":[
"dotnet5.6",
"portable-net45+win8"
]
}
},
"runtimes":{
"win10-x64":{
},
"win81-x64":{
},
"win8-x64":{
},
"win7-x64":{
}
},
"publishOptions":{
"exclude":[
"**.user",
"**.vspscc",
"wwwroot",
"node_modules"
]
},
"scripts":{
"prepublish":[
"npm install",
"bower install",
"gulp clean",
"gulp min"
]
}
}
修改project.json後,我得到這個錯誤:
Failed to make the following project runnable: MVC6_Full_Version (.NETCoreApp,Version=v1.0) reason: Expected coreclr library not found in package graph. Please try running dotnet restore again.
要解決這個問題,我跑dotnet restore
命令,但沒有運氣。
然後,我將此塊:
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
添加此塊後,我得到了一個不同的錯誤:
Code: NU1002 Description: The dependency Microsoft.NETCore.App 1.0.0 does not support framework .NETFramework,Version=v4.6.1.
基本上,我想在我的應用程序添加兩個引用 - .NET框架4.6.1和ASP.NET核心1.0。
如何解決這個問題?
你可以看看我的答案,希望他會LP。 http://stackoverflow.com/a/39420980/6535426 –