从VS发布到Azure时无法更改目标运行时 [英] Cannot change Target Runtime when publishing to Azure from VS
问题描述
我有一个ASP.Core RC2项目(使用了.NET 4.5.1框架),应将其作为x86网站部署在Azure上.
I have a ASP.Core RC2 project (.NET 4.5.1 framework is used) that should be deployed on Azure as x86 Web-Site.
在VS中的发布设置"选项卡上,有以下值:
On Publish Setting tab in VS there are the following values:
- 目标框架:.NET Framework 4.5.1
- 目标运行时:推断的运行时(win7-x64)
我要更改的是x86平台的目标运行时"的值,但是此组合框处于非活动状态(灰色).
What I want to change is the value of "Target Runtime" to x86 platform, but this combobox is inactive (grey).
当前project.json:
Current 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
可以下载还原时的运行时文件.
When you're developing self-contained applications, you have to add all required runtimes to the project.json
file, so that nuget/dotnet restore
can download the runtime files on restore.
将win7-x86
运行时添加到project.json
应该可以解决问题.
Adding the win7-x86
runtime to the project.json
should do the trick.
"runtimes": {
"win7-x64": { },
"win7-x86": { }
}
定位便携式应用程序时,不需要运行时"部分,但必须自己在目标计算机上安装运行时.有关更详细的信息,请参见 .NET Core应用类型文档.有关可移植性类型如何工作和配置的说明.
When you target portable apps, you don't need the runtimes section but you have to install the runtime yourself on the target machine. See .NET Core App Types documentation for a more detailed description on how portability types work and are configured.
这篇关于从VS发布到Azure时无法更改目标运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!