从VS发布到Azure时无法更改目标运行时

前端之家收集整理的这篇文章主要介绍了从VS发布到Azure时无法更改目标运行时前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个ASP.Core RC2项目(使用.NET 4.5.1框架),应该作为x86 Web站点部署在Azure上.

在VS中的“发布设置”选项卡上,有以下值:

>目标框架:.NET Framework 4.5.1
>目标运行时:推断运行时(win7-x64)

我想要改变的是x86平台的“目标运行时”的值,但这个组合框是无效的(灰色).

目前project.json:

{
"version": "1.0.0-*","dependencies": {
  "Microsoft.NETCore.Platforms": "1.0.1-*","Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final","Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final","Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final","Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final","Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final"
},"commands": {
  "web": "Microsoft.AspNet.Server.Kestrel"
},"buildOptions": {
  "emitEntryPoint": true
},"frameworks": {
  "net451": { }
},"publishOptions": {
  "include": [
    "appsettings.json","project.json","web.config","NlogWeb.config"
  ]
},"tools": {
  "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
    "version": "1.0.0-*","imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
  }
},"scripts": {
  "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}
}

解决方法

在开发自包含应用程序时,必须将所有必需的运行时添加到project.json文件中,以便nuget / dotnet restore可以在还原时下载运行时文件.

将win7-x86运行时添加到project.json应该可以解决问题.

"runtimes": {
    "win7-x64": { },"win7-x86": { } 
}

当您定位可移植应用程序时,您不需要运行时部分,但您必须自己在目标计算机上安装运行时.有关可移植性类型如何工作和配置的更详细说明,请参阅.NET Core App Types文档.

原文链接:https://www.f2er.com/aspnet/249246.html

猜你在找的asp.Net相关文章