在文件系统目录上使用带有 setParamFile 和 declareParamFile 的 msdeploy

Using msdeploy with setParamFile and declareParamFile over a filesystem directory

在我需要在各种环境中应用 entity framework 迁移的自动部署场景中,我想在具有声明和值参数 xml 文件的非 Web 项目上应用 msdeploy 样式参数化。

这对我们来说更容易,因为我们已经为其他 Web 项目维护了 declarations/values xml 文件,这样我们可以将所有参数化缩小到同一个地方,并能够重用我们现有的逻辑在各种项目上应用参数化。

我的第一个想法只是将现有的迁移项目复制到 'work' 文件夹,msdeploy 将在其中应用参数化。所以我选择了 dirpath 提供程序,并指定了声明和值 xml 文件:

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"

然而,它失败并出现以下错误:

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

following link 显示了将 Parameters.xml 与 dirPath 提供程序一起使用的示例。
但是值和声明都混合在同一个文件中,我想避免。

有没有办法将声明文件和值文件分开?

刚刚找到解决方法:
我首先从 dirPath 部署到 archiveDir,在那里我可以使用 -declareParamFile-setParamFile
然后我从 archiveDir 部署到 dirPath 并删除 archiveDir.