Merge multiple web projects into a single output zip package

℡╲_俬逩灬. 提交于 2020-01-21 05:40:06

问题


I'm using Visual Studio Online and working through building a continuous integration setup. The scenario I have requires that multiple web projects are built out to a single Azure App Service deployment. The catch is that "out of the box" when you create a new build, the Visual Studio Build task appears to create a separate zip file for each project in the solution, and then the Azure App Service Deploy task throws an error saying there is more than one file matching the pattern, which is *.zip.

What I'd like to do is build all of these projects out to a single location, merging the various projects together, and then Azure App Service Deploy only has a single zip file to push, which I know it can do just fine. My MSBuild arguments for the Visual Studio Build task are /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\". I tried removing the PackageAsSingleFile attribute but it still created the zip files.

Is the scenario I want to do possible in VSO, perhaps with a different set of command codes?


回答1:


Sounds like you need a PowerShell script or a few tasks, to manipulate the files and folders before publishing the artifact.

  1. Extract Files $(build.artifactstagingdirectory)\*.zip to $(build.artifactstagingdirectory)\Merged
  2. Archive Files $(build.artifactstagingdirectory)\Merged to $(build.artifactstagingdirectory)\Merged.zip
  3. Delete Files that we extracted using minimatch: !/**/*.zip
  4. Change your Azure App service deploy to look for: $(System.DefaultWorkingDirectory)/**/Merged.zip

https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=vsts



来源:https://stackoverflow.com/questions/52377689/merge-multiple-web-projects-into-a-single-output-zip-package

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