Azure DevOps Build Task: create a zip with contents identical to Visual Studio Publish

核能气质少年 提交于 2020-08-27 21:42:21

问题


In Visual Studio, when we publish to a folder, that folder contains exactly what we need to deploy.

In Azure Pipeline, the Build Solution task produces a a bunch of (to us) unnecessary files plus a zip file (nice!). The zip contains the files we need, but buried in an crazy deep folder path:

\Content\D_C\a\1\s\src\MyProject\obj\Release\Package\PackageTmp\our-files.dll

What we would prefer is:

\our-files.dll

It also modifies connectionStrings in the web.config to support the deploy script it ships with. We don't need that script and that modification is a pain (which we disabled by adding<AutoParameterizationWebConfigConnectionStrings>false</...> to the .csproj file - yuck!)` .

We tried fussing with the parameters in the Build Solution step:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
  • Changing DeployOnBuild to false caused the $(build.artifactsstagingdirectory) to be empty (causing the next step to deploy nothing)

  • Changing WebPublishMethod to FileSystem made no difference (try finding documentation on the allowed values!)

  • Changing PackageAsSingleFile to false did what one would expect - no zip, but the contents were still buried in that deep folder structure.

Our downstream script could open the manifest file, xpath out the deep path baked into the zip (does the path always start with d_C?), unzip and grab the contents from there - but what a pain and how unnecessary.

Is there a way to publish just a nice clean build - a zip with contents that directly unpacks to the same files as a plain-jane Publish from Visual Studio does?

来源:https://stackoverflow.com/questions/55925792/azure-devops-build-task-create-a-zip-with-contents-identical-to-visual-studio-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!