+1  A: 

You just have to include project_B.targets before project_A.

<Project DefaultTargets="Start" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  <Import Project="project_B.targets" />
  <Import Project="project_A.targets" />    

  <Import Project="Common.targets" />
</Project>

I think there is a mistake in this code :

<ItemGroup>
  <!-- Generates duplicates if used with Import -->
  <AssembliesToDeploy Include="@(AssembliesToDeploy)" />

  <AssembliesToDeploy Include="Assembly_B.dll">
    <AssemblyType>SomeType</AssemblyType>
    <ApplicationName>App_B</ApplicationName>
  </AssembliesToDeploy>
</ItemGroup>

You are using Import, so you if you use the code above you'll have duplicates in AssembliesToDeploy.

madgnome
@madgnome If I chnage the order of the Import I'll have the same issue when processing `@(AssembliesToDeploy)`. You are absolutly right that my try will result in duplicates - resulting in Assembly_A.dll still being deployed before Assembly_B.dll. So your answer doesn't solve my issue but found the flaw in my approach.
Filburt
@madgnome Of course it's `@(AssembliesToRemove)` if I change the order of Import ... ctrl-c ctrl-v
Filburt
@madgnome Thanks for your hint. I added the final(?) solution as a new answer for completness sake.
Filburt
A: 

Adopting from MadGnomes answer I decided to split the ItemGroups into separate .target files.

project_A_REMOVE.targets

<Project xmlns="...">
    <ItemGroup>
        <AssembliesToRemove Include="@(AssembliesToRemove)" />
        <AssembliesToRemove Include="Assembly_A.dll">
            <ApplicationName>App_A</ApplicationName>
        </AssembliesToRemove>
    </ItemGroup>
</Project>

project_A_DEPLOY.targets

<Project xmlns="...">
    <ItemGroup>
        <AssembliesToDeploy Include="@(AssembliesToDeploy)" />
        <AssembliesToDeploy Include="Assembly_A.dll">
            <AssemblyType>SomeType</AssemblyType>
            <ApplicationName>App_A</ApplicationName>
        </AssembliesToDeploy>
    </ItemGroup>
</Project>

and the same for project_B.targets.

The project_B.proj now looks like this

<Project DefaultTargets="Start" xmlns="...">
    <Import Project="project_A_REMOVE.targets" />
    <Import Project="project_B_REMOVE.targets" />

    <Import Project="project_B_DEPLOY.targets" />
    <Import Project="project_A_DEPLOY.targets" />

    <Import Project="Common.targets" />
</Project>

Since my real solution consist of some 58 projects this will result in a lot of .targets. Even more so because I have to keep a common .targets for every project.

Filburt