1

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.

Ashish Mishra
  • 411
  • 5
  • 25
  • What is your project type? Could you generated the .zip with those MSBuild arguments in your local without Azure devops? – Leo Liu May 17 '21 at 09:57
  • It is windows service targeting .net framework 4.8 (Console App). I am not able to generate zip on local as well. – Ashish Mishra May 17 '21 at 17:59
  • Yes, That seems only way. I am working on it. would mark resolved once get it done. Thanks – Ashish Mishra May 20 '21 at 16:58
  • Any update for this issue? Have you resolved this issue? If not, would you please let me know the latest information about this issue? – Leo Liu May 25 '21 at 09:39

1 Answers1

1

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:

enter image description here

Leo Liu
  • 71,098
  • 10
  • 114
  • 135