MSBuild task does not propagate Configuration property for referenced project assemblies
I have a solution with three projects, A, B, and CustomWrapper. A and B have a Debug, Retail, and a "Custom" configuration. The "Custom" configuration just has a different set of options (constants defined, assemblies referenced, optimation choices, etc).
B depends on A and has a ProjectReference to A as such:
<ItemGroup>
<ProjectReference Include="..\A\A.csproj">
<Project>{2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}</Project>
<Name>A</Name>
</ProjectReference>
</ItemGroup>
CustomWrapper is a project that should build the "Custom" configuration of A and B, independent of what configuration is currently selected for the solution in VS. I tried to achieve this by writing an MSBuild task by hand in Wrapper.proj as such:
<ItemGroup>
<ProjectReferences Include="..\A\A.csproj" />
<ProjectReferences Include="..\B\B.csproj" />
</ItemGroup>
<Target Name="BuildCustomConfiguration">
<MSBuild Projects="@(ProjectReferences)" Properties="Configuration=Custom" Targets="Build">
<Output TaskParameter="TargetOutputs" ItemName="CustomAssemblies" />
</MSBuild>
</Target>
When I compile the CustomWrapper project, bin\Custom\A.dll builds just fine. However, the problem I am running into is that bin\Custom\B.dll references bin\Debug\A.dll (assuming that the Debug configuration is selected in VS) instead of bin\Custom\A.dll. All other options are correctly passed in to B.csproj.
How can I get bin\Custom\B.dll to reference bin\Custom\A.dll?

