3

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?
Anemoia
  • 7,928
  • 7
  • 46
  • 71

1 Answers1

1

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.

chief7
  • 14,263
  • 14
  • 47
  • 80
  • Unfortunately the provider `package` is not compatible with the provider `dirPath`. `Error: Source (sitemanifest) and destination (dirPath) are not compatible for the given operation. Error count: 1.` – Anemoia Feb 22 '16 at 06:47
  • Yeah, forgot about the manifest. I updated my answer to account for the manifest and tested it so I know it works this time. Please let me know if you have any other issues. – chief7 Feb 22 '16 at 15:17