Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I define setParamFile using the MSDeploy API

How do I define the -setParamFile parameter from MSDeploy.exe using the MSDeploy API?

I'm trying to write the equivalent of the following in powerShell:

msdeploy -verb:sync -source:package="c:\MyZip.zip" -dest:auto -setParamFile="c:\StagingParameters.xml"

Here's what I have so far:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Deployment")
$destBaseOptions   = new-object Microsoft.Web.Deployment.DeploymentBaseOptions
$syncOptions       = new-object Microsoft.Web.Deployment.DeploymentSyncOptions
$deploymentObject = [Microsoft.Web.Deployment.DeploymentManager]::CreateObject("package","C:\MyZip.zip")

#TODO -setParamFile="c:\StagingParameters.xml"

$deploymentObject.SyncTo("auto","",$destBaseOptions,$syncOptions);
like image 475
Jonathan Matheus Avatar asked Feb 26 '23 20:02

Jonathan Matheus


1 Answers

Gotta love reflector!

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Deployment")
$destBaseOptions   = new-object Microsoft.Web.Deployment.DeploymentBaseOptions
$syncOptions       = new-object Microsoft.Web.Deployment.DeploymentSyncOptions
$deploymentObject = [Microsoft.Web.Deployment.DeploymentManager]::CreateObject("package","C:\MyZip.zip")

#-setParamFile
$deploymentObject.SyncParameters.Load("c:\StagingParameters.xml");

$deploymentObject.SyncTo("auto","",$destBaseOptions,$syncOptions);
like image 107
Jonathan Matheus Avatar answered Mar 07 '23 13:03

Jonathan Matheus