Reputation: 697
I have the following targets:
<Target Name="Build" DependsOnTargets="Build_Shared" />
<Target Name="Build_Shared" DependsOnTargets="Build_Shared_x86;Build_Shared_x64"/>
<Target Name="Build_Shared_x86" DependsOnTargets="SetPlatform_x86;Shared_1;..." />
<Target Name="Build_Shared_x64" DependsOnTargets="SetPlatform_x64;Shared_1;..." />
The problem is that Shared_1 dependency is not build in the x64 target. I guess MSBuild thinks that it is already build due to the x86 target. I don't want to create different x86/x64 targets for all my shared components. And i have applications (depending on Build_Shared) that require x86 and x64 to build so i need a dependency like this.
Upvotes: 0
Views: 33
Reputation: 100751
Note that each target is only executed once during the build. If you have multiple targets depending on your Shared_1
target, Shared_1
will only be run once, and will considered to already be run when a second DependsOnTargets="..;Shared_1;.."
is encountered.
If you need to run the same target multiple times, you need to use a nested msbuild command:
<Target Name="Build_Shared">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Shard_1" Properties="Platform=x86" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Shard_1" Properties="Platform=x64" />
</Target>
You could also use Targets="SetPlatform_x86;Shared_1;.."
if you need that.
Upvotes: 1