Update to latest version of .NET and packages - #210
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the repository to a newer .NET SDK/tooling baseline and modernizes CI/release workflows, while refreshing package dependencies and test infrastructure to use Microsoft Testing Platform.
Changes:
- Bump SDK tooling via
global.jsonand update central package versions (notablyMicrosoft.Extensions.*,NSubstitute, and xUnit MTP packages). - Migrate test projects to Microsoft Testing Platform extensions (TRX + code coverage) and simplify test target frameworks to
net8.0. - Refactor GitHub Actions workflows into reusable
build.ymlplus separate publish workflows, and switch solution definition from.slnto.slnx.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/MGR.CommandLineParser.UnitTests/MGR.CommandLineParser.UnitTests.csproj | Switch unit tests to Microsoft Testing Platform (TRX + coverage) and xUnit MTP package. |
| tests/MGR.CommandLineParser.IntegrationTests/MGR.CommandLineParser.IntegrationTests.csproj | Switch integration tests to Microsoft Testing Platform (TRX + coverage) and xUnit MTP package. |
| tests/Directory.Build.props | Update tests to target net8.0 only. |
| src/MGR.CommandLineParser/MGR.CommandLineParser.csproj | Include repo README.md in NuGet package and set PackageReadmeFile. |
| src/MGR.CommandLineParser.Hosting/MGR.CommandLineParser.Hosting.csproj | Include repo README.md in NuGet package and set PackageReadmeFile. |
| src/MGR.CommandLineParser.Command.Lambda/MGR.CommandLineParser.Command.Lambda.csproj | Include repo README.md in NuGet package and set PackageReadmeFile. |
| MGR.CommandLineParser.slnx | Add new XML-based solution definition. |
| MGR.CommandLineParser.sln | Remove legacy Visual Studio solution file. |
| global.json | Bump .NET SDK version and configure Microsoft Testing Platform as the test runner. |
| Directory.Packages.props | Update centralized package versions and swap to xUnit MTP + MTP extensions. |
| .github/workflows/release.yml | Rewire release pipeline to use new reusable build + publish workflows and update deploy-pages action. |
| .github/workflows/publish-packages-nuget.yml | Add reusable NuGet publish workflow using OIDC login. |
| .github/workflows/publish-packages-myget.yml | Add reusable MyGet publish workflow. |
| .github/workflows/generate-docs.yml | Update docs workflow actions and docfx action used. |
| .github/workflows/codeql-analysis.yml | Update to setup-dotnet via global.json and refresh checkout action. |
| .github/workflows/ci.yml | Rewire CI to use new reusable build workflow and separate publish workflow. |
| .github/workflows/buildAndPublish.yml | Remove old combined build/test/publish workflow. |
| .github/workflows/build.yml | Add new reusable build/test/coverage/package-artifact workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
Suppressed comments (5)
.github/workflows/build.yml:43
- TRX output is commonly written under nested TestResults subdirectories; the current glob (
TestResults/*_report.trx) won’t match in that case, causing test reporting to miss results. Using a recursive glob is safer without changing the test invocation.
name: .NET Tests
path: 'TestResults/*_report.trx'
reporter: dotnet-trx
tests/MGR.CommandLineParser.IntegrationTests/MGR.CommandLineParser.IntegrationTests.csproj:5
- After removing Microsoft.NET.Test.Sdk, this project no longer has a test-project marker (IsTestProject is not set anywhere in the repo). dotnet test may not discover or execute these tests unless IsTestProject is explicitly enabled.
<PropertyGroup>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>
tests/MGR.CommandLineParser.UnitTests/MGR.CommandLineParser.UnitTests.csproj:5
- After removing Microsoft.NET.Test.Sdk, this project no longer has IsTestProject set anywhere in the repo (and the usual SDK-based marker is gone). dotnet test may skip the project entirely unless IsTestProject is explicitly set.
<PropertyGroup>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>
.github/workflows/build.yml:35
- The repo no longer contains a .sln file and has multiple .csproj files at the repo root, so relying on bare
dotnet build/dotnet testcan fail depending on whether the SDK recognizes.slnxas a solution format. Pointing the commands explicitly atMGR.CommandLineParser.slnxavoids brittle CI behavior.
This issue also appears on line 41 of the same file.
- name: Build and Pack
run: dotnet build -c Release -p:Version=${{ steps.version.outputs.version}}
- name: Run tests
run: dotnet test -c Release --no-build --report-trx --report-trx-filename "{asm}_report.trx" --coverage --coverage-output-format cobertura
.github/workflows/codeql-analysis.yml:43
- With the .sln removed and multiple projects present,
dotnet build -c Releasecan fail if the SDK doesn’t auto-detect the new.slnxsolution format. Build the solution explicitly to keep CodeQL runs deterministic.
- name: Build projects
run: dotnet build -c Release
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.
Suppressed comments (3)
tests/MGR.CommandLineParser.UnitTests/Extensibility/Converters/FileSystemInfoConverterTests.cs:43
Path.GetTempPath()returns a path with a trailing directory separator, whilenew DirectoryInfo(value).FullNametypically normalizes by trimming it. This makes the subsequentAssert.Equal(value, ((DirectoryInfo)actual).FullName)brittle and can fail cross-platform.
{
// Arrange
IConverter converter = new FileSystemInfoConverter();
var value = Path.GetTempPath();
tests/MGR.CommandLineParser.IntegrationTests/UnspecifiedCommand/SimpleOptionsWithArgumentsTests.cs:16
Path.GetTempPath()returns a trailing directory separator; laterOutputDirectory.FullNamewill be normalized (typically without the trailing separator), makingAssert.Equal(expectedOutputDirectory, ...)fragile. Normalizing the temp directory string avoids OS-specific failures.
var fileArgument = Path.GetTempFileName();
var expectedOutputDirectory = Path.GetTempPath();
var expectedOutputFile = Path.GetTempFileName();
IEnumerable<string> args = ["import", fileArgument, "-p:50", @"-o:" + expectedOutputDirectory, @"-of:" + expectedOutputFile];
Directory.Packages.props:14
Microsoft.NET.Test.Sdkis still pinned here, but there are noPackageReference Include="Microsoft.NET.Test.Sdk"usages in the repo anymore (tests were moved to Microsoft Testing Platform). Keeping unused central package versions makes dependency management harder.
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated no new comments.
Suppressed comments (4)
tests/MGR.CommandLineParser.UnitTests/Extensibility/Converters/FileSystemInfoConverterTests.cs:27
Path.GetTempFileName()creates a real file on disk, which the test never cleans up. Since the converter only needs a syntactically valid path string, use a random filename under the temp directory instead to avoid leaving temp files behind.
var value = Path.GetTempFileName();
tests/MGR.CommandLineParser.UnitTests/Extensibility/Converters/FileSystemInfoConverterTests.cs:43
Path.GetTempPath()typically includes a trailing directory separator, whileDirectoryInfo.FullNamemay normalize that representation. Normalizing the expected path usingDirectoryInfo(...).FullNamewill prevent platform-specific assertion failures.
var value = Path.GetTempPath();
tests/MGR.CommandLineParser.IntegrationTests/UnspecifiedCommand/SimpleOptionsWithArgumentsTests.cs:15
Path.GetTempFileName()creates real files and the test does not clean them up. Also, comparing directory strings againstDirectoryInfo.FullNamecan be flaky due to normalization (e.g., trailing separators). Prefer non-creating temp paths and normalize the expected directory path.
var fileArgument = Path.GetTempFileName();
var expectedOutputDirectory = Path.GetTempPath();
var expectedOutputFile = Path.GetTempFileName();
.github/workflows/build.yml:43
- The TRX filename passed to
dotnet testdoes not include aTestResults/path, but the test reporter only looks inTestResults/*_report.trx. This mismatch can cause CI to report "no test results found" even when tests ran successfully; use a recursive glob (or align the output location) so results are always discovered.
name: .NET Tests
path: 'TestResults/*_report.trx'
reporter: dotnet-trx



No description provided.