Azure Pipelines 中的多行字符串 [英] Multiline string in Azure Pipelines

查看:21
本文介绍了Azure Pipelines 中的多行字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 Azure Pipelines 中使用多行 YAML 字符串吗?

使用 ASP.NET Core (.NET Framework) 模板,我尝试对 msbuildArgs 进行多行处理,但没有成功.

- 任务:VSBuild@1输入:解决方案:'$(解决方案)'msbuildArgs: >'/p:DeployOnBuild=true/p:WebPublishMethod=Package''/p:PackageAsSingleFile=true/p:SkipInvalidConfigurations=true''/p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)WebApp.zip"''/p:DeployIisAppPath="默认网站"'平台:'$(buildPlatform)'配置:'$(buildConfiguration)'

<块引用>

MSBUILD : 错误 MSB1008: 只能指定一个项目.
开关:'/p:DeployOnBuild=true

<小时>

查看 字符串参考文档我没有看到任何关于这个主题的内容.

解决方案

我总是使用 YAML block chomping operator 像这样

msbuildArgs: >-/p:DeployOnBuild=true/p:WebPublishMethod=包/p:PackageAsSingleFile=true/p:SkipInvalidConfigurations=true/p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)WebApp.zip"/p:DeployIisAppPath="默认网站"

效果很好,让事情变得清晰整洁

Can I use a multiline YAML string in Azure Pipelines?

Using the ASP.NET Core (.NET Framework) template I tried multilining the msbuildArgs but that didn't work.

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: >
       '/p:DeployOnBuild=true /p:WebPublishMethod=Package'
       '/p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true'
       '/p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)WebApp.zip"'
       '/p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

MSBUILD : error MSB1008: Only one project can be specified.
Switch: '/p:DeployOnBuild=true


Reviewing the string reference documentation I don't see any about this topic.

解决方案

I always use the YAML block chomping operator like this

msbuildArgs: >-
  /p:DeployOnBuild=true
  /p:WebPublishMethod=Package
  /p:PackageAsSingleFile=true
  /p:SkipInvalidConfigurations=true
  /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)WebApp.zip"
  /p:DeployIisAppPath="Default Web Site"

Works well and makes things crystal clear and neat

这篇关于Azure Pipelines 中的多行字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆