gpt4 book ai didi

powershell - 如何使用 MSDeploy API 定义 setParamFile

转载 作者:行者123 更新时间:2023-12-04 02:04:24 25 4
gpt4 key购买 nike

如何使用 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);

最佳答案

必须爱反光板!

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

关于powershell - 如何使用 MSDeploy API 定义 setParamFile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4170960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com