我想为每个 DeploymentTarget 执行一个操作,其中每个 ProjectsForDeployment 可以有超过 1 个。我知道如果每个 ProjectsForDeployment 只有 1 个 DeploymentTarget 子级,那么目标批处理会起作用 - 但是如果有多个子级会发生什么?是否仍然可以对 A1/A2/B1/B2 运行 ProcessDeployableObject 4 次,同时保持对兄弟姐妹和父级的引用?
谢谢!
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Deploy" >
<CallTarget Targets="ProcessDeployableProject" />
</Target>
<Target Name="ProcessDeployableProject" Inputs="@(ProjectsForDeployment)" Outputs="%(ProjectsForDeployment.Identity)\dummy.txt" >
<!-- Processing goes here for %(ProjectsForDeployment.DeploymentTarget), needs OtherMetadataWeNeed and ProjectsForDeployment.Identity too. -->
</Target>
<ItemGroup>
<ProjectsForDeployment Include="/src/A/A.csproj" >
<DeploymentTarget>A1</DeploymentTarget>
<DeploymentTarget>A2</DeploymentTarget>
<OtherMetadataWeNeed>Metadata</OtherMetadataWeNeed>
</ProjectsForDeployment>
<ProjectsForDeployment Include="/src/B/B.csproj" >
<DeploymentTarget>B1</DeploymentTarget>
<DeploymentTarget>B2</DeploymentTarget>
<OtherMetadataWeNeed>Metadata</OtherMetadataWeNeed>
</ProjectsForDeployment>
</ItemGroup>
</Project>