通往Azure Web应用程序的VSTS发布管道部署到wwwroot子目录

问题描述:

我的目标是创建一个自动构建/发布管道,该管道每次将GitHub项目中的代码与网站合并时都会更新Azure站点.

My goal is to create an automated build/release pipeline that updates an Azure site every time I merge code in the GitHub project with the website.

我在GitHub上有一个网站. VSTS GitHub构建任务成功构建了它. VSTS发布任务(部署Azure应用服务)将网站成功部署到Azure Web应用.我知道这一点是因为Azure应用程序的Azure应用程序服务编辑器在wwwroot下的子目录中显示了网站文件.由于文件被部署到子目录而不是直接部署到wwwroot,因此不会加载该站点. (为确保文件本身不是问题,我使用内置命令提示符生成新文件并在每个文件的内容中复制/粘贴内容,从而在wwwroot中手动添加了相同的文件.)

I have a website in GitHub. A VSTS GitHub build task builds it successfully. A VSTS release task (Deploy Azure App Service) deploys the site to an Azure web app successfully. I know this because the Azure App Service Editor for the Azure app shows the website files in a subdirectory under wwwroot. Because the files are deployed to a subdirectory rather than directly to wwwroot, the site won't load. (To make sure the files themselves were not the problem, I manually added the same files in wwwroot by generating new files with the built-in command prompt and copy/pasting in each file's content, and the site loaded fine.)

我已经多次编辑版本定义并创建了新版本,但无法弄清楚如何直接部署到wwwroot.管道中的所有其他内容都可以正常工作,包括自动触发器.

I have edited the release definition and created new releases many times but cannot figure out how to deploy directly to wwwroot. Everything else in the pipeline works, including the automatic triggers.

子目录的名称与版本定义的在代理上运行"窗格中显示的构建工件下载的名称匹配.它还与发布管道开始时使用的工件的源别名"字段中的名称匹配.

The subdirectory's name matches the name of the build artifact download shown in the "Run on Agent" pane of the release definition. It also matches the name in the "Source Alias" field of the artifact used at the beginning of the release pipeline.

$(System.DefaultWorkingDirectory)/在部署Azure App Service"配置设置的程序包或文件夹"字段中.

$(System.DefaultWorkingDirectory)/ is in the Package or folder field of the Deploy Azure App Service configuration settings.

如何将站点部署到wwwroot?谢谢您的任何见解.

How can I deploy the site to wwwroot? Thank you for any insights.

$(System.DefaultWorkingDirectory)/在部署Azure App Service"配置设置的包或文件夹"字段中不正确.解决:

$(System.DefaultWorkingDirectory)/ was incorrect in the "Package or folder" field of the "Deploy Azure App Service" configuration settings. To resolve:

  • 选择包或文件夹"旁边的...按钮.
  • 选择链接的工件"目录下的子目录(在我的情况下,该子目录的名称与工件设置"窗格中的源别名"相同).

我错误地选择了链接的工件".

I incorrectly had selected "Linked artifacts."

让我失望的是,您选择了一个子文件夹以部署到根目录,然后选择了根链接的工件以部署到一个子文件夹.

What threw me off is that you select a subfolder to deploy to root, and you select the root linked artifact to deploy to a subfolder.