Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public static void AssemblyInitialize(TestContext _)
Debug.WriteLine($"Building test assets and unzipping packages took: {sw.ElapsedMilliseconds} ms");
sw.Restart();
BuildTestAssets(nugetCache);
Debug.WriteLine($"Building test assets took: {sw.ElapsedMilliseconds} ms");
sw.Restart();
BuildTestAssetsCompatibility(nugetCache);
Debug.WriteLine($"Building test assets compatibility matrix took: {sw.ElapsedMilliseconds} ms");
sw.Restart();
Expand Down Expand Up @@ -228,12 +230,14 @@ private static void BuildTestAssetsCompatibility(string nugetCache)
var netTestSdkVersionDir = netTestSdkVersion.TrimStart('[').TrimEnd(']');
if (Directory.Exists(Path.Combine(nugetCache, "microsoft.testplatform", netTestSdkVersionDir)) && Directory.Exists(Path.Combine(nugetCache, "microsoft.testplatform.cli", netTestSdkVersionDir)))
{
Debug.WriteLine($"Version {netTestSdkVersion} of TestPlatform and TestPlatform.CLI is already in the cache, skipping restore.");
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Grammatically, this refers to two packages, so it should use plural agreement (e.g., 'are already in the cache').

Suggested change
Debug.WriteLine($"Version {netTestSdkVersion} of TestPlatform and TestPlatform.CLI is already in the cache, skipping restore.");
Debug.WriteLine($"Version {netTestSdkVersion} of TestPlatform and TestPlatform.CLI are already in the cache, skipping restore.");

Copilot uses AI. Check for mistakes.
continue;
}

// We restore this project to download TestPlatform and TestPlatform.CLI nugets, into our package cache.
// Using nuget.exe install errors out in various weird ways.
var tools = Path.Combine(Root, "test", "TestAssets", "Tools", "Tools.csproj");
Debug.WriteLine($"Restoring {tools} for {netTestSdkVersion}");
ExecuteApplication2(Dotnet, $"""restore --packages {nugetCache} {nugetFeeds} --source "{IntegrationTestEnvironment.LocalPackageSource}" "{tools}" -p:PackageVersion={netTestSdkVersionDir} """);
}

Expand All @@ -253,13 +257,14 @@ private static void BuildTestAssetsCompatibility(string nugetCache)
if (cacheIdText == currentCacheId)
{
// Project cache is up-to-date, just rebuilding solution.
ExecuteApplication2(Dotnet, $"""restore --packages {nugetCache} {nugetFeeds} --source "{IntegrationTestEnvironment.LocalPackageSource}" "{generatedSln}" """);
ExecuteApplication2(Dotnet, $"build {generatedSln} --no-restore --configuration {IntegrationTestEnvironment.BuildConfiguration} -v:minimal");
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Removing the dotnet restore here can break builds in cases where the cache-id matches but restore outputs are missing (e.g., cleared/expired NuGet cache, deleted obj/project.assets.json, or a partially-populated cache). Consider keeping a restore step, or gating --no-restore on the presence of required restore artifacts (e.g., solution/project assets files) before skipping restore.

Suggested change
ExecuteApplication2(Dotnet, $"build {generatedSln} --no-restore --configuration {IntegrationTestEnvironment.BuildConfiguration} -v:minimal");
ExecuteApplication2(Dotnet, $"build {generatedSln} --configuration {IntegrationTestEnvironment.BuildConfiguration} -v:minimal");

Copilot uses AI. Check for mistakes.
rebuild = false;
Debug.WriteLine("Test assets compatibility matrix is up to date, skipping regeneration.");
}

if (rebuild)
{
Debug.WriteLine("Generating test assets compatibility matrix.");
if (Directory.Exists(generated))
{
Directory.Delete(generated, recursive: true);
Expand Down