是否可以通过 MSDeploy 任务指定 preSync/postSync 命令?如果没有,我该如何做到这一点?
问问题
557 次
1 回答
1
您使用的是哪种 MSDeploy 任务?如果它是通过 msdeploy.exe 的 Exec,那么是的,当然,如果它是某种不直接支持它们的包装器,那么您可以通过使用 run-command 提供程序再次调用同步来模拟它们,因为 pre/post-sync 只是在 try/catch/finally 结构中再次调用同步,无论如何都包含主同步。
private int ExecuteWorker()
{
...
if (!this.HandleAuxillarySync("-preSync", this._commandLine._preSyncParameters, retbaseOptions2))
return -1;
DeploymentChangeSummary deploymentChangeSummary;
try
{
deploymentChangeSummary = @object.SyncTo(retproviderOptions2, retbaseOptions2, syncOptions);
}
...
finally
{
this.HandleAuxillarySync("-postSync", this._commandLine._postSyncParameters, retbaseOptions2);
}
this.HandleAuxillarySync("-postSyncOnSuccess", this._commandLine._postSyncOnSuccessParameters, retbaseOptions2);
...
private bool HandleAuxillarySync(string syncType, Dictionary<string, string> sourceParameters, DeploymentBaseOptions destBaseOptions)
{
...
try
{
using (DeploymentObject @object = DeploymentManager.CreateObject(retproviderOptions, retbaseOptions))
@object.SyncTo(destBaseOptions, syncOptions);
flag = true;
}
于 2012-06-05T22:36:03.147 回答