Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebDeploy: merge content

I have 2 builds (in TeamCity):

One that produces a backend for a website, with WebAPI.

I package that website with WebDeploy as such:

/p:DeployOnBuild=True /p:PublishProfile="Default" /p:ProfileTransformWebConfigEnabled=False

Which delivers me a nice WebDeploy.zip

Now I have a second build, which builds and compiles a website frontend.

Frontend and backend are being developed by different teams, and thus produce artifacts at different times.

I want to be able to deploy a version of the backend with the frontend merged in.

Now I have 2 options, either rebuild the backend with a dependency to the frontend (which creates a new unneeded build), or something else (which is what I really want).

I want to, given a web deploy package, merge in the files of the frontend, deploy the website to IIS.

Now I can manually unzip the webdeploy package and rebuild it by hand. However the paths in there are based on the paths of the location that it is built at (and I have no control over that).

Example: C_C\TeamCity\...blabla...\obj\Release\Package\PackageTmp\Web.config

Which makes it hard to find out the structure without parsing the archive.xml found at the root of the WebDeploy package.

It is possible, but ideally I would like an MSBuild command that would allow me to 'merge' the contents of a directory into this website.

Question:

  1. Is this possible with MSDeploy?
  2. If that is not possible, is it possible to change the directory naming insite the WebDeploy package, to have something more straightforward, for when I want to inject the additional files?
like image 959
Snake Avatar asked Sep 19 '26 04:09

Snake


1 Answers

You could deploy the package to a local directory using the dirPath provider, add your files and then repackage. First you need to create a destination manifest because WebDeploy creates the package with a source manifest. You can create a "DestManifest.xml" file with following contents:

<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
  <dirPath path="c:\repackagewebdeploy" />
  <auto />
  <auto />
</sitemanifest>

Then you can call MSDeploy to unpackage and repackage.

msdeploy -verb:sync -source:package=c:\packagePath\package.zip -dest:manifest=[path to destination manifest]
[copy files]
msdeploy -verb:sync -source:dirPath=c:\repackagewebdeploy -dest:package=c:\packagePath\newPackage.zip 

This assumes you don't need the other setAcl providers. We don't typically need these so I ignore them but you could add them back into the final package using a manifest instead of pulling using the dirPath directly.

like image 73
chief7 Avatar answered Sep 20 '26 17:09

chief7