3

I'm using Jenkins for Continuous Integration.

Right now I have a job with this command in Jenkins in the command line arguments for a build step:

enter image description here

This is the command:

"%WORKSPACE%\OEVizion\ITVizion.OEVizion.Web\ITVizion.OEVizion.Web.csproj" /p:DeployOnBuild=true /p:PublishProfile="IT Vizion - Web Deploy Package for a given domain.pubxml"

It works just fine, that is, the web deploy package (.zip) is created in the specified folder defined in the .pubxml file.

However what I'd like to do is to generate a .zip web deploy package for each of the .pubxml files that I have (right now 3) for this specific ITVizion.OEVizion.Web.csproj in a single shot\command.

With this I'd have multiple .zip packages with different settings ready to be deployed to different servers every time a commit is pushed to the repository and the project builds successfully.

Is this possible? How should I approach this?

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
  • While not exactly what you are asking, you can use the PackageWeb NuGet pkg http://sedodream.com/2012/03/14/PackageWebUpdatedAndVideoBelow.aspx to generate a pkg that has transforms inside of it. It also produces a .ps1 so you can invoke them. – Sayed Ibrahim Hashimi Apr 14 '15 at 21:36

2 Answers2

3

The best practice is to build only once and then publish multiples times from the same build. Here is a screenshot of how to set that up:

Build once and publish 3 environments

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
  • This is a great answer and it works for me, but it also doesn't feel as efficient as it could be. You're still creating a unique deploy package for each profile. Is there a way to use that same exact build object and only transform the required file/files? In other words, to have a single build output and all of the xformed files. When deploying, copy the build output and only the appropriate xformed files. That way we'd _really_ only have a single build artifact and only the unique files would have to be managed. – Max Cascone Mar 15 '21 at 17:07
  • 1
    But, as it seems, the other 3 steps will still perform a build before publishing, or am I wrong? – marsze Aug 11 '21 at 13:46
2

After posting the question I saw the way to go about this: Add multiple build steps. One for each .pubxml file. That way the build process will run 3 times for the 3 publish profiles and you'll end up with 3 web deploy .zip packages at the end of the Job execution in Jenkins. Nice.

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480