-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests.proj doesn't filter to best TargetFramework when running Test target #66122
Comments
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsThis results in the build only building for the best TargetFramework, but the Test Target running for all TargetFrameworks, which fails because none of the tests are built for those frameworks. For example:
This regressed with 9ebe0ef#diff-5ef2fd16f58de91bff2f05ad601ab6ff000c0febabb2312d232f20cfa132a71b in #64000 This change made The The MSBuild Traversal SDK's As a workaround for folks that hit this try adding the following to tests.proj. <Target Name="WorkaroundIssue" BeforeTargets="Test">
<ItemGroup>
<ProjectReference Condition="'%(ProjectReference.SetTargetFramework)' != ''"
AdditionalProperties="%(ProjectReference.AdditionalProperties);TargetFramework=%(ProjectReference.SetTargetFramework)" />
</ItemGroup>
</Target>
|
@ViktorHofer not asking you to fix this, but what do you think the right fix should be for this? Should we make a change to the traversal SDK, add a target to |
Thanks for reporting. I didn't observe such behavior locally as I didn't run all tests via the traversal project. Unfortunately there is no CI protection for this path. Anyway, microsoft/MSBuildSdks#342 should fix this. |
UPDATE: I see Viktor just put a PR up, so you can ignore below: @ericstj the workaround appears to have some of the tests attempt to execute the assembly directly:
|
I'll give things a try locally and see if I can provide a better workaround. Alternatively you could also try to apply @ViktorHofer's change manually to |
The linked PR fixes the issue (applied the changes locally to my |
This results in the build only building for the best TargetFramework, but the Test Target running for all TargetFrameworks, which fails because none of the tests are built for those frameworks. For example:
This regressed with 9ebe0ef#diff-5ef2fd16f58de91bff2f05ad601ab6ff000c0febabb2312d232f20cfa132a71b in #64000
This change made
tests.proj
switch from using thebuildMultiTargeting
tobuild
targets in https://github.com/dotnet/arcade/tree/main/src/Microsoft.DotNet.Build.Tasks.TargetFramework/srcThe
buildMultiTargeting
targets useAdditionalProperties
to apply the best target framework, whereas thebuild
targets useSetTargetFramework
.The MSBuild Traversal SDK's
Build
Target honorsSetTargetFramework
while theTest
target does not. This is why the test target ends up running for all target frameworks.As a workaround for folks that hit this try adding the following to tests.proj.
The text was updated successfully, but these errors were encountered: