Make VSTest target depend on _ComputeTargetFrameworkItems #13893
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes microsoft/vstest#2570 by moving
_ComputeTargetFrameworkItems
outside the CallTargets used inside the VSTest target. This means that@(_InnerBuildProjects)
is available in all CallTarget scopes.What happened in a tiny sample project with a multitargeted library and a test assembly that @dsplaisted used was this:
VSTest
target runs in the library, creating a CallTarget scope.BuildProject
runs, creating a CallTarget scope._ComputeTargetFrameworkItems
runs, populating@(_InnerBuildProjects)
.VSTest
target runs in the test project, and eventually calls down to the normal build process.GetTargetFrameworks
on the library project._ComputeTargetFrameworkItems
has already run and skips it.GetTargetFrameworksWithPlatformFromInnerBuilds
, but doesn't have access to@(_InnerBuildProjects)
because it's trapped in a scope, so the dispatch fails.Step 8 is what's new. That was computed before dotnet/msbuild#5657 with only evaluation-time data, but now requires multitargeting dispatch.
Ideally, we'll eliminate
CallTarget
entirely. At this late time, however, this is a safer choice: ensure that@(_InnerBuildProjects)
is populated in the biggest possible scope before any of theVSTest
machinery runs by depending on it fromVSTest
.