Skip to content
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

Fix tests running on version freeze #10735

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

YuliiaKovalova
Copy link
Member

Fixes #10702

Context

The issue stemmed from a missing Microsoft.Build package during the test execution. CustomCheck is compiled using a specific version of Microsoft.Build, but during the CheckCandidate run, this package couldn't be restored. This mismatch led to the problem.
Build FAILED. "/Users/runner/work/1/s/artifacts/bin/Microsoft.Build.BuildCheck.UnitTests/Debug/net9.0/TestAssets/CheckCandidate/CheckCandidate.csproj" (Restore target) (1) -> (Restore target) -> /Users/runner/work/1/s/artifacts/bin/Microsoft.Build.BuildCheck.UnitTests/Debug/net9.0/TestAssets/CheckCandidate/CheckCandidate.csproj : warning NU1701: Package 'Microsoft.IO.Redist 6.0.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net8.0'. This package may not be fully compatible with your project. "/Users/runner/work/1/s/artifacts/bin/Microsoft.Build.BuildCheck.UnitTests/Debug/net9.0/TestAssets/CheckCandidate/CheckCandidate.csproj" (Restore target) (1) -> (Restore target) -> /Users/runner/work/1/s/artifacts/bin/Microsoft.Build.BuildCheck.UnitTests/Debug/net9.0/TestAssets/CheckCandidate/CheckCandidate.csproj : error NU1102: Unable to find package Microsoft.Build with version (>= 17.12.0)

Solution

Pack Microsoft.Build and it's dependencies for the tests to a specific location.

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Let's just try to make this more incremental friendly

@@ -46,4 +50,10 @@
</None>
</ItemGroup>

<Target Name="MSBuildPackagesForTests" AfterTargets="Build">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels as possibly expensive target - can it have inputs and outputs defined to allow for incrementality?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please let me know if I got you right with my last change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants