3
votes

I'm attempting to create a build that will build my solution, apply web.config transforms as necessary and finally copy desired output (a built web api project) to the artifacts area of the build.

I'm using the Deployment...Azure WebApp Template with the Azure App Service Deploy step disabled (as we're in the middle of a move to Azure), with the following build arguments in the build step:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\" /p:AutoParameterizationWebConfigConnectionStrings=False

All works as expected, apart from the structure of the resulting zip file, which has the following structure:

{ZipFileName}{ProjectName\Content\C_C\a\1\s\Api{ProjectName\obj\Release\Package\PackageTmp...{BuildContent}

I'd like the content to be at the root of the published zip file if possible. Is the best way to manipulate the content of $(build.artifactstagingdirectory) using Powershell or a number of the other built in build tasks?

1
"which is in order to find the built project:" what do you mean by that?Luca Cappa
Yes it was badly written, have edited.Matt Rowett
@MattRowett Do you solve this issue?starian chen-MSFT
@Matt, how did you get MSBuild step to generate a Web Deploy Package? I have used your suggested parameters for MSBuild, but I can't seem to get it to generate the zip.CesarB
@cesarb do you mean to deploy to an Azure App Service? If so there's a build task specifically for that. This was to get direct access to the nested build content output by the build step.Matt Rowett

1 Answers

2
votes

You don’t need to worry about it, because it won’t keep the folder structure (Just the files and folders in PackageTmp folder) after deploy to web server (e.g. IIS, Azure Web App)

If you still need to just include the files in PackageTmp folder, you can add build step to archive file to zip file through Archive Files step.

For Visual Studio Build step, specify /p:DeployOnBuild=true to MSBuild Arguments.

enter image description here