Open MIchaelRShea opened 1 year ago
@YuliiaKovalova Team triage: we need an initial investigation done on this issue.
@MIchaelRShea I try to repro your issues with the sample solution I created. sample.zip
Could you have a look if there are any differences between your repro steps and mine?
@JanKrivanek Could you help me take a look if there is something I misunderstood in the repro steps?
@JaynieBai - I haven't look deeper (as I'm not profficient in this area and would need to swap-in more context) - but first thing I see is that I'm not seeing the dynamic resolution opt-in (EnableDynamicPlatformResolution
) in your projects (nor binlog) - could you add that and see?
@MIchaelRShea - since you flashed out the proposal for fix - would you be interested in creating a PR (or draft proposal PR) so that we can run it through our infra tests?
Issue Description
Defining a project configuration for one project in a solution turns off dynamic platform negotiation for all projects in the solution graph.
This is because the conditional to turn off dynamic platform negotiation is <Target Name="_GetProjectReferencePlatformProperties" Condition="'$(EnableDynamicPlatformResolution)' == 'true' and '$(CurrentSolutionConfigurationContents)' == '' and '@(_MSBuildProjectReferenceExistent)' != ''">
'$(CurrentSolutionConfigurationContents)' == '' turns off negotiation on to broad of a level and this should instead be done on a per project basis.
Steps to Reproduce
Create a solution that references projects outside of that solution. define a configuration for all projects in the solution Make sure there is a need for negotiation in the inside to outside solution reference IE x64->AnyCPU Build said solution.
the inner to outer solution dependency will not do negotiation and therefore not build as AnyCPU
Expected Behavior
If a project does not have a configuration in a solution, platform negotiation should take place regardless of other projects configuration.
Actual Behavior
If a project does not have a configuration in a solution, but other projects do, platform negotiation will not take place for the project without a configuration.
Analysis
<Target Name="_GetProjectReferencePlatformProperties" Condition="'$(EnableDynamicPlatformResolution)' == 'true' and '$(CurrentSolutionConfigurationContents)' == '' and '@(_MSBuildProjectReferenceExistent)' != ''">
I believe '$(CurrentSolutionConfigurationContents)' == '' can be removed from this conditional since we already check for setplatforms on the individual project level
Versions & Configurations
No response