Search code examples
directoryapp-configmsdeployparameterization

Using msdeploy with setParamFile and declareParamFile over a filesystem directory


In an automated deployment scenario where I need to apply entity framework migrations in various environment I would like to apply msdeploy style parametrization over a non web project with declarations and values parameters xml files.

It's easier for us because we already maintain declarations/values xml files for other web projects and this way we would tiny all our parametrization to the same place and be able to reuse our existing logic for applying parametrization over various project.

My first though was just to copy the existing migration project to a 'work' folder, where msdeploy would apply parametrization. So I went with the dirpath provider and I specify both the declarations and values xml files:

msdeploy
  -verb:sync
  -source:dirPath="c:\Sources\Project.Migrations"
  -dest:dirPath="c:\work\Project.Migration"
  -setParamFile:"c:\Deployment\SomeEnv\Project.Migrations.SetParameters.xml"
  -declareParamFile:"c:\Sources\Project.Migrations\Parameters.xml"

Nevertheless, it fails with the following error:

EXEC : error : The 'MSDeploy.dirPath' object does not support declared parameters.

The following link shows an exemple of using Parameters.xml with dirPath provider.
But both value and declaration are mixed up in the same file which I would like to avoid.

Is there a way I could have both declaration and values files split up ?


Solution

  • Just found a workaround to this:
    I first deploy from a dirPath to an archiveDir where I could use -declareParamFile and -setParamFile.
    Then I deploy from the archiveDir to a dirPath and delete the archiveDir.