我一直在努力将部署操作附加到我的Web项目文件中,以便从TeamCity部署Web项目。如何将和步骤括起来,以便不需要重复条件检查?
<Target Name="Deploy">
<PropertyGroup Condition=" '$(Configuration)' == 'Development-Publish' ">
<ScriptPath>c:\scripts\development.txt</ScriptPath>
<DeploymentPath>\\devserver\dev</DeploymentPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Integration-Publish' ">
<ScriptPath>c:\scripts\integration.txt</ScriptPath>
<DeploymentPath>\\integrationserver\int</DeploymentPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Staging-Publish' ">
<ScriptPath>c:\scripts\staging.txt</ScriptPath>
<DeploymentPath>\\stagingserver\staging</DeploymentPath>
</PropertyGroup>
<PropertyGroup>
<BeyondCompareCommand>C:\Program Files\Beyond Compare 3\BCompare.exe</BeyondCompareCommand>
<AdditionalArguments>/silent /closescript</AdditionalArguments>
<DeploymentCommand>"$(BeyondCompareCommand)" @"$(ScriptPath)" "$(WebProjectOutputDir)" "$(DeploymentPath)" $(AdditionalArguments)</DeploymentCommand>
</PropertyGroup>
<Message Condition=" '$(DeploymentPath)' != '' " Importance="high" Text="Executing Deployment with this command: $(DeploymentCommand)" />
<Exec Condition=" '$(DeploymentPath)' != '' " Command="$(DeploymentCommand)" />
</Target>
我想我应该有一个
<Target Name="DeploymentParameters"/>
哪一个
<Target Name="Deploy" DependsOnTargets="DeploymentParameters"/>
但除非我犯了错误,否则我似乎无法访问
DeploymentParameters
目标。