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

Move test projects to SDK-based .csproj #10087

Merged
merged 27 commits into from
Jul 29, 2024
Merged

Move test projects to SDK-based .csproj #10087

merged 27 commits into from
Jul 29, 2024

Conversation

joelverhagen
Copy link
Member

@joelverhagen joelverhagen commented Jul 29, 2024

This will make transitive project references work much better. This would help with a repository merge since a package reference switching to a project reference will then still retain transitive dependency information. In legacy .csproj, project references are not transitive so without this change we would need to lift a lot of project dependencies into consuming projects when, say, NuGetGallery.Core switches from package reference to project reference.

This work also has the effect of modernizing our code base a bit. It theoretically makes a .NET Core move easier too.

This was done using the latest version of the .NET upgrade-assistant CLI tool with the following options:

upgrade-assistant upgrade {csproj path} --operation sdkstyle --non-interactive.

Unit tests will be run using dotnet test instead of xunit.console.runner. This is a modernization step. Functional tests still use xunit and vstest due to compatibility with old web test framework we use.

This does most of the hard work. After this, I did manual clean-up steps:

  1. Add SdkProjects.props import
  2. Add <IsTestProject>true</IsTestProject> to functional test .csproj. Xunit test projects have this automatically.
  3. Remove unnecessary package, project, and assembly references.
  4. Delete AssemblyInfo.cs unless there was Xunit parallelization attributes or custom metadata
  5. Delete App.config in most cases (only leave minimal necessary things like EF directives)
  6. Rename BuildTests.ps1 to BuildGalleryFunctionalTests.ps1 to ease repository merge with NuGet.Jobs
  7. Move functional test .sln to be in the root so it's easier to find
  8. Move to latest lang version
  9. Move to latest build tools
  10. Switch PublishTestResults CI step to the latest version and change format to VSTest (dotnet test) so test results are found

@joelverhagen joelverhagen requested a review from a team as a code owner July 29, 2024 13:55
@joelverhagen joelverhagen requested a review from jimmylewis July 29, 2024 19:34
@joelverhagen joelverhagen merged commit d0b5fa9 into dev Jul 29, 2024
2 checks passed
@joelverhagen joelverhagen deleted the jver-sdk branch July 29, 2024 22:59
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