7

I am in the process of creating an application to allow the automation of application deployments, (https://github.com/twistedtwig/AutomdatedDeployments#readme).

The idea being that everything is in source control, application files, application configuration as well as IIS configuration. My application allows the solution to auto deploy, (adding a post build setp to the sln / proj file), after a build to the dev machine. It will allow the CI server to auto deploy to its machine for testing as well as the CI Server pushing successful builds to QA / Test / production servers. One of the issues I have with msdeploy is the requirement of IIS to be setup with the website / application before hand, (which my app is trying to get around).

So far I can create, update and remove, app pools, websites and applications via config files automatically. I can sync files and folders fine. The last step was to use the /target:package switch in msbuild to create clean file structures for web deployments. For example I would run a command like:

msbuild.exe myMvcSite.csproj /target:clean /target:package /p:Configuration=Release /p:_PackageTempDir=C:\websites\mySite  /p:PackageLocation=C:\dropLocation\mySite.zip

This creates a nice zip file with the internal file path of "C_C\wbesites\mySite" ready (as I understand it) to be sync'd to the production server.

My issue is how I deploy this zip file. I want it to be independent of any IIS information, i.e. I am simply pushing the files / folders to a location, (either on the local machine for developers, or remote for testing etc). The setup of IIS with app pools and sites etc would be taken care of separately. Some of the commands (and their output) I have tried are below:

"C:\Program Files\IIS\Microsoft Web Deploy v2\msdeploy.exe" -verb:sync -source:package="C:\Temp\deploy\installer\test\testPackage.zip" -dest:auto
Info: Adding sitemanifest (sitemanifest).
Error: The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.
Error count: 1.

and

"C:\Program Files\IIS\Microsoft Web Deploy v2\msdeploy.exe" -verb:sync -source:package="C:\website\installer\testPackage.zip" -dest:contentpath=C:\temp\mytest
Error: Source (sitemanifest) and destination (contentPath) are not compatible for the given operation.
Error count: 1.

The first command I am trying to let it unpack the files with the structure it has. It seems to be upset about app pool stuff though, (which I don't want it to touch).

The second I am trying to get around the "auto" bit but this isn't happy either.

I am struggling to find much information about this process.

The only way I can see how I might achieve this at the moment is to not use msdeploy for it, but to create my own task to integrate the file structure and do the file syncing my self, (not ideal).

Jon
  • 15,110
  • 28
  • 92
  • 132
  • What error are you receiving on the second command? – Richard Szalay Sep 23 '12 at 23:07
  • Error: Source (sitemanifest) and destination (contentPath) are not compatible for the given operation. Error count: 1. (the second code block in my question). – Jon Sep 24 '12 at 08:10

1 Answers1

1

I ended up coding around this issue, rather than being able to solve it.

I take the zip package:

  1. unzip in a temp location
  2. find the final path it will be going to (normally from archive.xml)
  3. check to see if I am merging the folders or doing a clean install, (i.e. do I delete the destination folder first).
  4. copy / push files to end location, (normally with msdeploy).

I open sourced my solution to this: https://github.com/twistedtwig/AutomatedDeployments

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
Jon
  • 15,110
  • 28
  • 92
  • 132