blomster
blomster

Reputation: 806

Visual Studio Team Services dotnet publish

My build completes with no errors, but it creates a randomly named zip file (s.zip) for the release step.

After the release step, I end up with that s.zip in inetpub/wwwroot/admin-tool/ folder. I'm almost there, but I want it to unzip and dump all the contents in here. This should be automatic, shouldn't it?

My dotnet publish looks like this: enter image description here and cause this to run, which is how I get the s.zip:

C:\Program Files\dotnet\dotnet.exe publish C:\agent\_work\3\s\Angular.AdminTool.csproj -c release --output C:\agent\_work\3\a\s

If I try to edit the -o argument and make it -o $(Build.ArtifactStagingDirectory)/admin-tool I will just end up with C:\agent\_work\3\a\admin-tool\s.zip

Is getting the name of my zip to be the same as the name of my web-site (admin-tool) the key to getting the zip to automatically extract in the release step?

Upvotes: 0

Views: 762

Answers (2)

ajaxer
ajaxer

Reputation: 136

I also ran into this issue but solved it another way.

In my case I have a single project to build and deploy. The $(Parameters.RestoreBuildProjects) value is set to a single project MyProjectFolder/MyProject.csproj. In the .Net Core Publish task, this value is used in the Path to Project(s) field. Then I tick both the boxes for fragment of Publish task

I saved and queued this pipeline. The zip file created seems to be derived from the name of the folder so I ended up with a zip file in the artifact staging directory with the name of the project. Then the Publish Artifact task placed this zip file into the Artifact that is named in that task. fragment from artifact explorer

Upvotes: 0

blomster
blomster

Reputation: 806

In case it help others, I used the simple command line tools rather than the pre-canned "dotnet core" ones:

enter image description here

and for the Archive files task, be sure to include a hard-coded name for the zip to be used in the build process:

enter image description here

And for the release, in the "Deploy IIS App" task, be sure to include the full path for the zip file: enter image description here

Upvotes: 1

Related Questions