如何使用 MSDeploy API 定义 setParamFile

发布于 2024-10-03 00:01:26 字数 734 浏览 3 评论 0原文

如何使用 MSDeploy API 从 MSDeploy.exe 定义 -setParamFile 参数?

我正在尝试在 powerShell 中编写与以下内容等效的内容:

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

这是迄今为止我所拥有的:

[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);

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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀟灑尐姊 2024-10-10 00:01:26

一定要喜欢反光板!

[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);

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文