【问题标题】:Using VSTS to publish Azure Function to Zip file使用 VSTS 将 Azure Function 发布到 Zip 文件
【发布时间】:2018-10-26 04:35:50
【问题描述】:

我正在尝试使用 VSTS 发布包含 Azure 函数的项目。我的 MSBuild 步骤是传递以下构建参数

/p:Configuration=发布 /p:DeployOnBuild=true /p:WebPublishMethod=包 /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\MyFunctions.$(Build.BuildNumber)-dev.zip" /p:DeployIisAppPath="默认网站"

这给了我一个 Zip,其中 \Content\D_C\a\3\s\MyFunctions\obj\Release\net461\PubTmp\Out 的文件夹结构. Out 目录包含我需要的内容以及我期望的根目录

我需要推送一个Zip的文件夹结构是

据记录 Here

谁能告诉我我在这里做错了什么?

谢谢

【问题讨论】:

  • 你试过推吗?你的包没有问题,你不应该关心VSTS路径
  • 你解决了这个问题吗?

标签: msbuild azure-functions azure-pipelines


【解决方案1】:

我分两步完成

  1. 使用带有设置/p:DeployOnBuild=true /p:DeployTarget=Package;CreatePackageOnPublish=true 的 VSTS 构建任务进行构建
  2. 使用 VSTS 存档文件任务对其进行压缩。在这里,我将选项留给 Prefix root folder name... 未选中。

示例:

【讨论】:

  • 此方法生成的 zip 文件与问题海报完全相同
【解决方案2】:

使用 Azure App Service Deploy 任务和 Publish using Web Deploy 选项,它不会保留文件夹结构,内容文件将位于 wwwroot 文件夹中 的 azure 应用服务。所以你不需要关心包文件夹结构。

否则,您可以通过FileSystem发布方法(例如/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish)发布应用程序,然后通过存档文件任务压缩文件,之后您可以通过Zip推送部署方式部署它(Azure CLI或 PowerShell)

Zip push deployment for Azure Functions

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-11
    • 2018-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多