假设我有一个包含 3 个应用程序的项目结构:
├───app1
├───app2
├───app3
我想要一个 msbuild 任务将每个应用程序的相关输出复制到单独的部署位置
deploy\app1\<app1.output>
deploy\app2\<app2.output>
deploy\app3\<app3.output>
下面的脚本执行以下操作:
deploy\app1\<app1.output> + <app2.output> + <app3.output>
deploy\app2\<app1.output> + <app2.output> + <app3.output>
deploy\app3\<app1.output> + <app2.output> + <app3.output>
我知道批处理有问题,但我不知道如何修复它。有什么想法我错了吗?
<Target Name="Deploy">
<!-- Ensure the target home exists -->
<MakeDir Directories="$(DeployPath)" />
<!-- Select artefacts -->
<ItemGroup>
<ProjectPath Include="%(Project.BuildOutput)" />
<ArtefactSource Include="%(ProjectPath.RootDir)%(ProjectPath.Directory)**\*.*" />
</ItemGroup>
<!-- copy files to respective artefact location -->
<Copy SourceFiles="@(ArtefactSource)" DestinationFolder="$(DeployPath)\%(Project.Identity)"
Condition="'%(Project.CanDeploy)' AND '%(Project.TestWasRun)' != 'Error'" />
</Target>