尝试针对.net framework 4.6.x编译我的asp.netcore 1.1应用程序 我的project.json:
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
],
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
},
"net462": {
}
},
然后包恢复抱怨:
Package Microsoft.NETCore.App 1.1.0 is not compatible with net462 (.NETFramework,Version=v4.6.2). Package Microsoft.NETCore.App 1.1.0 supports: netcoreapp1.0 (.NETCoreApp,Version=v1.0)
One or more packages are incompatible with .NETFramework,Version=v4.6.2.
答案 0 :(得分:1)
您的框架部分应如下所示:
"frameworks": {
"net461": { }
}
或者这里是net461上asp.net核心的project.json的完整模板 您可以通过选择New Project | Visual C#| Windows | Web | ASP.NET核心Web应用程序(.Net Framework)
在Visual Studio中创建此类项目。{
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"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"
},
"frameworks": {
"net461": { }
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
答案 1 :(得分:-1)
在框架部分之前有一个部分仍然是“硬编码”到.netcore框架。我刚刚删除它并且它有效