有几个答案(例如this和this)和一篇博客文章指出了如何安装 Visual C++ 2010 可再发行包作为 Azure 云服务部署的一部分。
首先,将 vcredist_x64.exe 添加到 Web 项目,并将其“复制到输出目录”属性设置为“如果较新则复制”或“始终复制”。然后你对包含单行的命令文件(在我的例子中是“InstallVC.cmd”)执行相同的操作:
vcredist_x64.exe /q /norestart
然后编辑 ServiceDefinition.csdef 文件以包含设置
<Startup>
<Task commandLine="InstallVC.cmd" executionContext="elevated" taskType="simple" />
</Startup>
角色内。答案和博客文章继续指出,如果将 ServiceConfiguration.csfg 上的 osFamily 设置设置为 osFamily="1" 并且需要将其设置为 osFamily="2",则启动任务将挂起.
我的设置为 osFamily="4",但部署失败。我收到错误消息Role has encountered an error and has stopped. Application startup task failed with exit code 5100
。
作为使用更新的 Azure OS 系列部署 Azure 云服务的一部分,如何安装 Visual C++ 2010 可再发行包?