0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.