From b3f66f806d38f05dc1837228b3ff933a02c9a2f1 Mon Sep 17 00:00:00 2001 From: stan-sz <37585349+stan-sz@users.noreply.github.com> Date: Thu, 2 Oct 2025 09:57:47 +0200 Subject: [PATCH 1/7] MSTest 3.11 https://github.com/microsoft/testfx/releases/tag/v3.11.0 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 0e48bd3..3c5a6c4 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "MSTest.Sdk": "3.9.1" + "MSTest.Sdk": "3.11.0" } } From 0824cb28e401849893cb77971d6dc119168476ed Mon Sep 17 00:00:00 2001 From: Stanislaw Szczepanowski <37585349+stan-sz@users.noreply.github.com> Date: Fri, 10 Oct 2025 08:45:00 +0200 Subject: [PATCH 2/7] Code fixes --- src/Common.Tests/Hashing/DirectoryFileHasherTests.cs | 4 ++-- src/Common.Tests/Hashing/OutputHasherTests.cs | 2 +- src/Common.Tests/HexUtilitiesTests.cs | 6 +++--- src/Common.Tests/PathHelperTests.cs | 4 ++-- src/Repack.Tests/RepackTests.cs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Common.Tests/Hashing/DirectoryFileHasherTests.cs b/src/Common.Tests/Hashing/DirectoryFileHasherTests.cs index 37f1dd4..341c143 100644 --- a/src/Common.Tests/Hashing/DirectoryFileHasherTests.cs +++ b/src/Common.Tests/Hashing/DirectoryFileHasherTests.cs @@ -19,7 +19,7 @@ public class DirectoryFileHasherTests public TestContext TestContext { get; set; } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - [DataTestMethod] + [TestMethod] [DataRow(@"X:\Dir\Foo\1.0.0\lib\Foo.dll", true)] [DataRow(@"x:\dIR\Foo\1.0.0\lib\Foo.dll", true)] [DataRow(@"x:\OtherDir\foo.txt", false)] @@ -30,7 +30,7 @@ public void ContainsPath(string path, bool expectedResult) Assert.AreEqual(expectedResult, hasher.ContainsPath(path)); } - [DataTestMethod] + [TestMethod] [DataRow(@"Dir\Foo\1.0.0\lib\Foo.dll", true)] [DataRow(@"dIR\Foo\2.0.0\lib\Foo.dll", true)] [DataRow(@"OtherDir\foo.txt", false)] diff --git a/src/Common.Tests/Hashing/OutputHasherTests.cs b/src/Common.Tests/Hashing/OutputHasherTests.cs index b112dcf..ed046b2 100644 --- a/src/Common.Tests/Hashing/OutputHasherTests.cs +++ b/src/Common.Tests/Hashing/OutputHasherTests.cs @@ -50,7 +50,7 @@ public async Task ComputeHashFileNotFound() string file = Path.Combine(dir, "file.txt"); // Ensure exceptions are propagated correctly. - await Assert.ThrowsExceptionAsync(async () => await hasher.ComputeHashAsync(file, CancellationToken.None)); + await Assert.ThrowsExactlyAsync(async () => await hasher.ComputeHashAsync(file, CancellationToken.None)); } [TestMethod] diff --git a/src/Common.Tests/HexUtilitiesTests.cs b/src/Common.Tests/HexUtilitiesTests.cs index 72e04b4..d292a95 100644 --- a/src/Common.Tests/HexUtilitiesTests.cs +++ b/src/Common.Tests/HexUtilitiesTests.cs @@ -10,7 +10,7 @@ namespace Microsoft.MSBuildCache.Tests; [TestClass] public class HexUtilitiesTests { - [DataTestMethod] + [TestMethod] [DataRow("0123456789ABCDEFabcdef", new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0xAB, 0xCD, 0xEF, })] [DataRow("", null)] [DataRow(null, null)] @@ -29,12 +29,12 @@ public void HexToBytes(string hex, byte[]? expectedBytes) Assert.AreEqual(expectedBytes.Length, bytes.Length); for (int i = 0; i < expectedBytes.Length; i++) { - Assert.AreEqual(expectedBytes[i], bytes[i], "Index {0}", i); + Assert.AreEqual(expectedBytes[i], bytes[i], $"Index {i}"); } } [TestMethod] - public void HexToBytesOddChars() => Assert.ThrowsException(() => HexUtilities.HexToBytes("fAbCd")); + public void HexToBytesOddChars() => Assert.ThrowsExactly(() => HexUtilities.HexToBytes("fAbCd")); [TestMethod] public void HexToBytesBadChars() diff --git a/src/Common.Tests/PathHelperTests.cs b/src/Common.Tests/PathHelperTests.cs index bf4c008..e5f4601 100644 --- a/src/Common.Tests/PathHelperTests.cs +++ b/src/Common.Tests/PathHelperTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.MSBuildCache.Tests; [TestClass] public class PathHelperTests { - [DataTestMethod] + [TestMethod] [DataRow(@"X:\A\B\C", @"X:\A", @"B\C")] // Lots of .. and . [DataRow(@"X:\Z\..\A\B\.\C", @"X:\Y\..\D\..\A\.\.", @"B\C")] @@ -27,7 +27,7 @@ public class PathHelperTests public void MakePathRelative(string path, string basePath, string? expectedResult) => Assert.AreEqual(expectedResult, path.MakePathRelativeTo(basePath)); - [DataTestMethod] + [TestMethod] [DataRow(@"X:\A\B\C\file.txt", @"X:\A", true)] // Lots of .. and . [DataRow(@"X:\Z\..\A\B\.\C\file.txt", @"X:\Y\..\D\..\A\.\.", true)] diff --git a/src/Repack.Tests/RepackTests.cs b/src/Repack.Tests/RepackTests.cs index b2e2504..3ef2789 100644 --- a/src/Repack.Tests/RepackTests.cs +++ b/src/Repack.Tests/RepackTests.cs @@ -16,7 +16,7 @@ namespace Microsoft.MSBuildCache.Repack.Tests; [TestClass] public class RepackTests { - [DataTestMethod] + [TestMethod] [DataRow(typeof(MSBuildCacheAzureBlobStoragePlugin))] [DataRow(typeof(MSBuildCacheAzurePipelinesPlugin))] [DataRow(typeof(MSBuildCacheLocalPlugin))] From d284b2b49cd07f881a88a4dc4c8a96e01680294d Mon Sep 17 00:00:00 2001 From: stan-sz <37585349+stan-sz@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:05:01 +0100 Subject: [PATCH 3/7] Update global.json --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 3c5a6c4..5a4b699 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "MSTest.Sdk": "3.11.0" + "MSTest.Sdk": "3.11.1" } } From 642d1123541cb27e38653aacd3ad1ebf0cfb93f8 Mon Sep 17 00:00:00 2001 From: Stanislaw Szczepanowski <37585349+stan-sz@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:46:39 +0100 Subject: [PATCH 4/7] Fix command line --- .azuredevops/pipelines/official.yml | 2 +- .azuredevops/pipelines/pr-ci.yml | 2 +- global.json | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.azuredevops/pipelines/official.yml b/.azuredevops/pipelines/official.yml index 477cb52..f21b1de 100644 --- a/.azuredevops/pipelines/official.yml +++ b/.azuredevops/pipelines/official.yml @@ -100,4 +100,4 @@ extends: inputs: command: test projects: $(Build.SourcesDirectory)/MSBuildCache.sln - arguments: -restore:false --no-build --configuration $(BuildConfiguration) -- --report-trx --results-directory $(Agent.TempDirectory) \ No newline at end of file + arguments: -restore:false --no-build --configuration $(BuildConfiguration) --report-trx --results-directory $(Agent.TempDirectory) \ No newline at end of file diff --git a/.azuredevops/pipelines/pr-ci.yml b/.azuredevops/pipelines/pr-ci.yml index 0934d8f..87a1e22 100644 --- a/.azuredevops/pipelines/pr-ci.yml +++ b/.azuredevops/pipelines/pr-ci.yml @@ -54,7 +54,7 @@ jobs: inputs: command: test projects: $(Build.SourcesDirectory)/MSBuildCache.sln - arguments: -restore:false --no-build --configuration $(BuildConfiguration) -- --report-trx --results-directory $(Agent.TempDirectory) + arguments: -restore:false --no-build --configuration $(BuildConfiguration) --report-trx --results-directory $(Agent.TempDirectory) - publish: $(ArtifactsDirectory) displayName: Publish Artifacts diff --git a/global.json b/global.json index 5a4b699..b0d3854 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,8 @@ { "msbuild-sdks": { "MSTest.Sdk": "3.11.1" + }, + "test": { + "runner": "Microsoft.Testing.Platform" } } From 9ca66848f38398a531a4dfacf211f584750792c9 Mon Sep 17 00:00:00 2001 From: Stanislaw Szczepanowski <37585349+stan-sz@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:59:02 +0100 Subject: [PATCH 5/7] .NET 10 SDK --- .azuredevops/pipelines/official.yml | 5 +++-- .azuredevops/pipelines/pr-ci.yml | 5 +++-- .azuredevops/pipelines/templates/variables.yml | 1 - global.json | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.azuredevops/pipelines/official.yml b/.azuredevops/pipelines/official.yml index f21b1de..be38281 100644 --- a/.azuredevops/pipelines/official.yml +++ b/.azuredevops/pipelines/official.yml @@ -87,9 +87,10 @@ extends: - checkout: self fetchDepth: 0 - task: UseDotNet@2 - displayName: 'Install .NET $(DotNetVersion)' + displayName: 'Install .NET SDK from global.json' inputs: - version: '$(DotNetVersion)' + packageType: 'sdk' + useGlobalJson: true - task: NuGetAuthenticate@1 displayName: NuGet Authenticate - script: | diff --git a/.azuredevops/pipelines/pr-ci.yml b/.azuredevops/pipelines/pr-ci.yml index 87a1e22..cba3e89 100644 --- a/.azuredevops/pipelines/pr-ci.yml +++ b/.azuredevops/pipelines/pr-ci.yml @@ -38,9 +38,10 @@ jobs: fetchDepth: 0 - task: UseDotNet@2 - displayName: 'Install .NET $(DotNetVersion)' + displayName: 'Install .NET SDK from global.json' inputs: - version: '$(DotNetVersion)' + packageType: 'sdk' + useGlobalJson: true - task: NuGetAuthenticate@1 displayName: NuGet Authenticate diff --git a/.azuredevops/pipelines/templates/variables.yml b/.azuredevops/pipelines/templates/variables.yml index fd8e4a8..8083ed0 100644 --- a/.azuredevops/pipelines/templates/variables.yml +++ b/.azuredevops/pipelines/templates/variables.yml @@ -1,6 +1,5 @@ variables: BuildConfiguration: Release - DotNetVersion: '8.x' LogDirectory: $(Build.ArtifactStagingDirectory)\logs ArtifactsDirectory: $(Build.ArtifactStagingDirectory)\artifacts # https://github.com/microsoft/azure-pipelines-agent/pull/4077 diff --git a/global.json b/global.json index b0d3854..c6f582d 100644 --- a/global.json +++ b/global.json @@ -4,5 +4,9 @@ }, "test": { "runner": "Microsoft.Testing.Platform" + }, + "sdk": { + "version": "10.0.100", + "rollForward": "latestMinor" } } From f47cebba8721d131d0639568918398040cc3db2e Mon Sep 17 00:00:00 2001 From: Stanislaw Szczepanowski <37585349+stan-sz@users.noreply.github.com> Date: Mon, 8 Dec 2025 19:44:39 +0100 Subject: [PATCH 6/7] Fix --- .azuredevops/pipelines/official.yml | 17 +++++++---------- .azuredevops/pipelines/pr-ci.yml | 10 +++++++--- global.json | 4 ---- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.azuredevops/pipelines/official.yml b/.azuredevops/pipelines/official.yml index 4678006..c07f923 100644 --- a/.azuredevops/pipelines/official.yml +++ b/.azuredevops/pipelines/official.yml @@ -87,18 +87,15 @@ extends: - checkout: self fetchDepth: 0 - task: UseDotNet@2 - displayName: 'Install .NET SDK from global.json' + displayName: 'Install .NET 9.x' inputs: - packageType: 'sdk' - useGlobalJson: true + version: '9.x' + - task: UseDotNet@2 + displayName: 'Install .NET $(DotNetVersion)' + inputs: + version: '$(DotNetVersion)' - task: NuGetAuthenticate@1 displayName: NuGet Authenticate - script: | dotnet build $(Build.SourcesDirectory)/MSBuildCache.sln --configuration $(BuildConfiguration) -BinaryLogger:$(LogDirectory)/msbuild.binlog - displayName: Build - - task: DotNetCoreCLI@2 - displayName: Run Unit Tests - inputs: - command: test - projects: $(Build.SourcesDirectory)/MSBuildCache.sln - arguments: -restore:false --no-build --configuration $(BuildConfiguration) --report-trx --results-directory $(Agent.TempDirectory) + displayName: Build \ No newline at end of file diff --git a/.azuredevops/pipelines/pr-ci.yml b/.azuredevops/pipelines/pr-ci.yml index 3b7c2c4..e29db97 100644 --- a/.azuredevops/pipelines/pr-ci.yml +++ b/.azuredevops/pipelines/pr-ci.yml @@ -38,10 +38,14 @@ jobs: fetchDepth: 0 - task: UseDotNet@2 - displayName: 'Install .NET SDK from global.json' + displayName: 'Install .NET 9.x' inputs: - packageType: 'sdk' - useGlobalJson: true + version: '9.x' + + - task: UseDotNet@2 + displayName: 'Install .NET $(DotNetVersion)' + inputs: + version: '$(DotNetVersion)' - task: NuGetAuthenticate@1 displayName: NuGet Authenticate diff --git a/global.json b/global.json index d9cefec..7819a7e 100644 --- a/global.json +++ b/global.json @@ -8,9 +8,5 @@ }, "test": { "runner": "Microsoft.Testing.Platform" - }, - "sdk": { - "version": "10.0.100", - "rollForward": "latestMinor" } } From ec3f3cfc8c4ac38dcc28a91ec32aa1372c514ee5 Mon Sep 17 00:00:00 2001 From: Stanislaw Szczepanowski <37585349+stan-sz@users.noreply.github.com> Date: Tue, 9 Dec 2025 07:51:23 +0100 Subject: [PATCH 7/7] Fix --- .azuredevops/pipelines/pr-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azuredevops/pipelines/pr-ci.yml b/.azuredevops/pipelines/pr-ci.yml index e29db97..f09eed2 100644 --- a/.azuredevops/pipelines/pr-ci.yml +++ b/.azuredevops/pipelines/pr-ci.yml @@ -59,7 +59,7 @@ jobs: inputs: command: test projects: $(Build.SourcesDirectory)/MSBuildCache.sln - arguments: -restore:false --no-build --configuration $(BuildConfiguration) --report-trx --results-directory $(Agent.TempDirectory) + arguments: -restore:false --no-build --configuration $(BuildConfiguration) - publish: $(ArtifactsDirectory) displayName: Publish Artifacts