简体   繁体   中英

Azure Build task for Windows Service :- no zip under $(build.artifactstagingdirectory)

We have an azure pipeline which produces a zip artifact in $(build.artifactstagingdirectory). Later we extract this and deploy to target folder. This works fine with websites. The msbuildargs looks like below:-

msbuildArgs : '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'

We have a windows service which is not generating any zip artifact. After following article . I added /p:OutDir="$(build.stagingDirectory) in msbuildargs, Now I can see the files, but no zip file. Which we actually use.

msbuildArgs : '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:OutputPath="$(Build.ArtifactStagingDirectory)"'

is there any csproj settings for zip artifact? any specific setting for windows service? Could not find more documents for PackageAsSingleFile.

is there any csproj settings for zip artifact? any specific setting for windows service? Could not find more documents for PackageAsSingleFile.

Most of your MSBuild arguments are apply to ASP .NET projects and will do nothing for a windows service (Console App).

We just need to use /p:OutDir=$(Build.ArtifactStagingDirectory) . That will tell MSBuild to put the build outputs in the artifact staging directory.

But this still will not generate zip package with the argument /p:OutDir=$(Build.ArtifactStagingDirectory) . If you want to to generate zip, we could use the task Archive files .

Besides, we could change the /p:OutDir to other folder, so that we could use Archive files task to generate zip, like:

/p:OutDir=$(System.DefaultWorkingDirectory)/output

Then use the archive file task:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM