时,如果您熟悉PowerShell和希望与依赖于工作,尝试psake 。是什么样子:
psake script.ps1:-------
properties {
$dbServer = 'sqlexpress'
...
}
task default -depend StopServer1, StopServer2
task StopS1 -depend MakeS1Backup, StopSqlServer1 {
...
}
task MakeS1Backup {
... make backup
}
task StopSqlServer1 {
stop-service ...
}
# and anything similar to StopServer2
然后,你可以这样调用(有更多的选择):
Invoke-Psake script.ps1
#or
Invoke-Psake script.ps1 -task StopS1 #calls only StopS1 task and all other scripts it depends on
#or
Invoke-Psake script.ps1 -task MakeS1Backup #only backups S1, it doesn't depend on anything else
它所做的 - 它停止服务器1(任务StopS1),并在此之前,它的过程StopS1依赖的所有任务。因此,在停止S1的S1备份并停止Sql server 1之前等等。
我喜欢它比msbuild配置,这是非常详细和丑陋(虽然非常强大),好得多。
这看起来很有希望。 – Filburt 2010-05-14 20:28:43