From 09c4cf805367b798d103bfb6fb46a144f26048aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 22 Oct 2025 14:01:59 +0200 Subject: [PATCH 1/7] No nuget access --- azure-pipelines-official.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 442ad55ab2..07768595d6 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -129,6 +129,8 @@ extends: name: $(DncEngInternalBuildPool) image: windows.vs2022preview.amd64 os: windows + settings: + networkIsolationPolicy: Permissive,CFSClean customBuildTags: - ES365AIMigrationTooling stages: From 6b7671f0ed1666ffa4d64af860c06d4e4704643a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 22 Oct 2025 17:36:39 +0200 Subject: [PATCH 2/7] copy nuget.config into base vstest dir --- .../IntegrationTestBase.cs | 3 +++ .../TempDirectory.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index 2fab9fa01c..60522f2d23 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -59,8 +59,11 @@ public IntegrationTestBase() { _testEnvironment = new IntegrationTestEnvironment(); BuildConfiguration = IntegrationTestEnvironment.BuildConfiguration; + + TempDirectory.NuGetConfigPath = Path.Combine(IntegrationTestEnvironment.RepoRootDirectory, "NuGet.config"); TempDirectory = new TempDirectory(); + var drive = new DriveInfo(Directory.GetDirectoryRoot(TempDirectory.Path)); Console.WriteLine($"Available space for TEMP: {drive.Name} {drive.AvailableFreeSpace / (1024 * 1024)} MB"); diff --git a/test/Microsoft.TestPlatform.TestUtilities/TempDirectory.cs b/test/Microsoft.TestPlatform.TestUtilities/TempDirectory.cs index e8fb8fa0ad..8595e94e9b 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/TempDirectory.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/TempDirectory.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Runtime.CompilerServices; using IO = System.IO; @@ -23,6 +24,8 @@ public TempDirectory() public string Path { get; } + public static string? NuGetConfigPath { get; set; } + public void Dispose() { Dispose(true); @@ -91,12 +94,25 @@ public string CopyFile(string filePath) /// /// Path of the created directory. /// + [MethodImpl(MethodImplOptions.Synchronized)] internal static string CreateUniqueDirectory() { var temp = GetTempPath(); var directoryPath = IO.Path.Combine(temp, "vstest", RandomId.Next()); Directory.CreateDirectory(directoryPath); + if (NuGetConfigPath == null) + { + throw new InvalidOperationException("NuGetConfigPath on TempDirectory class must be set."); + } + + var tempNugetConfigPath = IO.Path.Combine(directoryPath, IO.Path.GetFileName(NuGetConfigPath)); + + if (!File.Exists(tempNugetConfigPath)) + { + File.Copy(NuGetConfigPath, tempNugetConfigPath); + } + return directoryPath; } From 2848fa13ff9913092879d1847c945cd88813b1d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 24 Oct 2025 09:29:25 +0200 Subject: [PATCH 3/7] Use nuget verify --- eng/common/post-build/nuget-verification.ps1 | 117 +------------------ 1 file changed, 3 insertions(+), 114 deletions(-) diff --git a/eng/common/post-build/nuget-verification.ps1 b/eng/common/post-build/nuget-verification.ps1 index a365194a93..bcf4906d66 100644 --- a/eng/common/post-build/nuget-verification.ps1 +++ b/eng/common/post-build/nuget-verification.ps1 @@ -1,121 +1,10 @@ -<# -.SYNOPSIS - Verifies that Microsoft NuGet packages have proper metadata. -.DESCRIPTION - Downloads a verification tool and runs metadata validation on the provided NuGet packages. This script writes an - error if any of the provided packages fail validation. All arguments provided to this PowerShell script that do not - match PowerShell parameters are passed on to the verification tool downloaded during the execution of this script. -.PARAMETER NuGetExePath - The path to the nuget.exe binary to use. If not provided, nuget.exe will be downloaded into the -DownloadPath - directory. -.PARAMETER PackageSource - The package source to use to download the verification tool. If not provided, nuget.org will be used. -.PARAMETER DownloadPath - The directory path to download the verification tool and nuget.exe to. If not provided, - %TEMP%\NuGet.VerifyNuGetPackage will be used. -.PARAMETER args - Arguments that will be passed to the verification tool. -.EXAMPLE - PS> .\verify.ps1 *.nupkg - Verifies the metadata of all .nupkg files in the currect working directory. -.EXAMPLE - PS> .\verify.ps1 --help - Displays the help text of the downloaded verifiction tool. -.LINK - https://github.com/NuGet/NuGetGallery/blob/master/src/VerifyMicrosoftPackage/README.md -#> - -# This script was copied from https://github.com/NuGet/NuGetGallery/blob/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1 - -[CmdletBinding(PositionalBinding = $false)] param( - [string]$NuGetExePath, - [string]$PackageSource = "https://api.nuget.org/v3/index.json", - [string]$DownloadPath, - [Parameter(ValueFromRemainingArguments = $true)] - [string[]]$args + [string[]] $Path ) -# The URL to download nuget.exe. -$nugetExeUrl = "https://dist.nuget.org/win-x86-commandline/v4.9.4/nuget.exe" - -# The package ID of the verification tool. -$packageId = "NuGet.VerifyMicrosoftPackage" - -# The location that nuget.exe and the verification tool will be downloaded to. -if (!$DownloadPath) { - $DownloadPath = (Join-Path $env:TEMP "NuGet.VerifyMicrosoftPackage") -} - -$fence = New-Object -TypeName string -ArgumentList '=', 80 - -# Create the download directory, if it doesn't already exist. -if (!(Test-Path $DownloadPath)) { - New-Item -ItemType Directory $DownloadPath | Out-Null -} -Write-Host "Using download path: $DownloadPath" - -if ($NuGetExePath) { - $nuget = $NuGetExePath -} else { - $downloadedNuGetExe = Join-Path $DownloadPath "nuget.exe" - - # Download nuget.exe, if it doesn't already exist. - if (!(Test-Path $downloadedNuGetExe)) { - Write-Host "Downloading nuget.exe from $nugetExeUrl..." - $ProgressPreference = 'SilentlyContinue' - try { - Invoke-WebRequest $nugetExeUrl -OutFile $downloadedNuGetExe - $ProgressPreference = 'Continue' - } catch { - $ProgressPreference = 'Continue' - Write-Error $_ - Write-Error "nuget.exe failed to download." - exit - } - } - - $nuget = $downloadedNuGetExe -} - -Write-Host "Using nuget.exe path: $nuget" -Write-Host " " - -# Download the latest version of the verification tool. -Write-Host "Downloading the latest version of $packageId from $packageSource..." -Write-Host $fence -& $nuget install $packageId ` - -Prerelease ` - -OutputDirectory $DownloadPath ` - -Source $PackageSource -Write-Host $fence -Write-Host " " - -if ($LASTEXITCODE -ne 0) { - Write-Error "nuget.exe failed to fetch the verify tool." - exit -} - -# Find the most recently downloaded tool -Write-Host "Finding the most recently downloaded verification tool." -$verifyProbePath = Join-Path $DownloadPath "$packageId.*" -$verifyPath = Get-ChildItem -Path $verifyProbePath -Directory ` - | Sort-Object -Property LastWriteTime -Descending ` - | Select-Object -First 1 -$verify = Join-Path $verifyPath "tools\NuGet.VerifyMicrosoftPackage.exe" -Write-Host "Using verification tool: $verify" -Write-Host " " - -# Execute the verification tool. -Write-Host "Executing the verify tool..." -Write-Host $fence -& $verify $args -Write-Host $fence -Write-Host " " - -# Respond to the exit code. +dotnet nuget verify $Path if ($LASTEXITCODE -ne 0) { - Write-Error "The verify tool found some problems." + Write-Error "The verify tool found some problems. See above." } else { Write-Output "The verify tool succeeded." } From 4068524a0d8dba2292e47e627b77ca1a840ee12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 24 Oct 2025 17:44:57 +0200 Subject: [PATCH 4/7] add global.json --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 5ebef2be03..093bf2c3ac 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.100-preview.7.25372.107", + "version": "10.0.100-rtm.25476.104", "paths": [ ".dotnet", "$host$" @@ -34,7 +34,7 @@ "vs": { "version": "17.8.0" }, - "dotnet": "10.0.100-preview.7.25372.107" + "dotnet": "10.0.100-rtm.25476.104" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25408.3" From ef178c4ea2bbf473840545b69e63c0cdc210efc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 24 Oct 2025 17:46:33 +0200 Subject: [PATCH 5/7] roll --- eng/common/post-build/global.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 eng/common/post-build/global.json diff --git a/eng/common/post-build/global.json b/eng/common/post-build/global.json new file mode 100644 index 0000000000..94748aca9f --- /dev/null +++ b/eng/common/post-build/global.json @@ -0,0 +1,9 @@ +{ + "sdk": { + "version": "9.0.0", + "paths": [ + ".dotnet", + "$host$" + ], + "rollForward": "major" +} \ No newline at end of file From f353111f2adb9bf95b3abde29a9cfbb5472255a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 10 Nov 2025 19:44:24 +0100 Subject: [PATCH 6/7] Revert --- azure-pipelines-official.yml | 2 - eng/common/post-build/global.json | 9 -- eng/common/post-build/nuget-verification.ps1 | 117 ++++++++++++++++++- global.json | 4 +- 4 files changed, 116 insertions(+), 16 deletions(-) delete mode 100644 eng/common/post-build/global.json diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 07768595d6..442ad55ab2 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -129,8 +129,6 @@ extends: name: $(DncEngInternalBuildPool) image: windows.vs2022preview.amd64 os: windows - settings: - networkIsolationPolicy: Permissive,CFSClean customBuildTags: - ES365AIMigrationTooling stages: diff --git a/eng/common/post-build/global.json b/eng/common/post-build/global.json deleted file mode 100644 index 94748aca9f..0000000000 --- a/eng/common/post-build/global.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "sdk": { - "version": "9.0.0", - "paths": [ - ".dotnet", - "$host$" - ], - "rollForward": "major" -} \ No newline at end of file diff --git a/eng/common/post-build/nuget-verification.ps1 b/eng/common/post-build/nuget-verification.ps1 index bcf4906d66..a365194a93 100644 --- a/eng/common/post-build/nuget-verification.ps1 +++ b/eng/common/post-build/nuget-verification.ps1 @@ -1,10 +1,121 @@ +<# +.SYNOPSIS + Verifies that Microsoft NuGet packages have proper metadata. +.DESCRIPTION + Downloads a verification tool and runs metadata validation on the provided NuGet packages. This script writes an + error if any of the provided packages fail validation. All arguments provided to this PowerShell script that do not + match PowerShell parameters are passed on to the verification tool downloaded during the execution of this script. +.PARAMETER NuGetExePath + The path to the nuget.exe binary to use. If not provided, nuget.exe will be downloaded into the -DownloadPath + directory. +.PARAMETER PackageSource + The package source to use to download the verification tool. If not provided, nuget.org will be used. +.PARAMETER DownloadPath + The directory path to download the verification tool and nuget.exe to. If not provided, + %TEMP%\NuGet.VerifyNuGetPackage will be used. +.PARAMETER args + Arguments that will be passed to the verification tool. +.EXAMPLE + PS> .\verify.ps1 *.nupkg + Verifies the metadata of all .nupkg files in the currect working directory. +.EXAMPLE + PS> .\verify.ps1 --help + Displays the help text of the downloaded verifiction tool. +.LINK + https://github.com/NuGet/NuGetGallery/blob/master/src/VerifyMicrosoftPackage/README.md +#> + +# This script was copied from https://github.com/NuGet/NuGetGallery/blob/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1 + +[CmdletBinding(PositionalBinding = $false)] param( - [string[]] $Path + [string]$NuGetExePath, + [string]$PackageSource = "https://api.nuget.org/v3/index.json", + [string]$DownloadPath, + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$args ) -dotnet nuget verify $Path +# The URL to download nuget.exe. +$nugetExeUrl = "https://dist.nuget.org/win-x86-commandline/v4.9.4/nuget.exe" + +# The package ID of the verification tool. +$packageId = "NuGet.VerifyMicrosoftPackage" + +# The location that nuget.exe and the verification tool will be downloaded to. +if (!$DownloadPath) { + $DownloadPath = (Join-Path $env:TEMP "NuGet.VerifyMicrosoftPackage") +} + +$fence = New-Object -TypeName string -ArgumentList '=', 80 + +# Create the download directory, if it doesn't already exist. +if (!(Test-Path $DownloadPath)) { + New-Item -ItemType Directory $DownloadPath | Out-Null +} +Write-Host "Using download path: $DownloadPath" + +if ($NuGetExePath) { + $nuget = $NuGetExePath +} else { + $downloadedNuGetExe = Join-Path $DownloadPath "nuget.exe" + + # Download nuget.exe, if it doesn't already exist. + if (!(Test-Path $downloadedNuGetExe)) { + Write-Host "Downloading nuget.exe from $nugetExeUrl..." + $ProgressPreference = 'SilentlyContinue' + try { + Invoke-WebRequest $nugetExeUrl -OutFile $downloadedNuGetExe + $ProgressPreference = 'Continue' + } catch { + $ProgressPreference = 'Continue' + Write-Error $_ + Write-Error "nuget.exe failed to download." + exit + } + } + + $nuget = $downloadedNuGetExe +} + +Write-Host "Using nuget.exe path: $nuget" +Write-Host " " + +# Download the latest version of the verification tool. +Write-Host "Downloading the latest version of $packageId from $packageSource..." +Write-Host $fence +& $nuget install $packageId ` + -Prerelease ` + -OutputDirectory $DownloadPath ` + -Source $PackageSource +Write-Host $fence +Write-Host " " + +if ($LASTEXITCODE -ne 0) { + Write-Error "nuget.exe failed to fetch the verify tool." + exit +} + +# Find the most recently downloaded tool +Write-Host "Finding the most recently downloaded verification tool." +$verifyProbePath = Join-Path $DownloadPath "$packageId.*" +$verifyPath = Get-ChildItem -Path $verifyProbePath -Directory ` + | Sort-Object -Property LastWriteTime -Descending ` + | Select-Object -First 1 +$verify = Join-Path $verifyPath "tools\NuGet.VerifyMicrosoftPackage.exe" +Write-Host "Using verification tool: $verify" +Write-Host " " + +# Execute the verification tool. +Write-Host "Executing the verify tool..." +Write-Host $fence +& $verify $args +Write-Host $fence +Write-Host " " + +# Respond to the exit code. if ($LASTEXITCODE -ne 0) { - Write-Error "The verify tool found some problems. See above." + Write-Error "The verify tool found some problems." } else { Write-Output "The verify tool succeeded." } diff --git a/global.json b/global.json index 093bf2c3ac..5ebef2be03 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.100-rtm.25476.104", + "version": "10.0.100-preview.7.25372.107", "paths": [ ".dotnet", "$host$" @@ -34,7 +34,7 @@ "vs": { "version": "17.8.0" }, - "dotnet": "10.0.100-rtm.25476.104" + "dotnet": "10.0.100-preview.7.25372.107" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25408.3" From 7701e676e78f314a4b13f6989f867134a8e90d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 10 Nov 2025 19:47:00 +0100 Subject: [PATCH 7/7] Revert --- eng/common/post-build/nuget-verification.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/post-build/nuget-verification.ps1 b/eng/common/post-build/nuget-verification.ps1 index a365194a93..ac5c69ffca 100644 --- a/eng/common/post-build/nuget-verification.ps1 +++ b/eng/common/post-build/nuget-verification.ps1 @@ -30,7 +30,7 @@ [CmdletBinding(PositionalBinding = $false)] param( [string]$NuGetExePath, - [string]$PackageSource = "https://api.nuget.org/v3/index.json", + [string]$PackageSource = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json", [string]$DownloadPath, [Parameter(ValueFromRemainingArguments = $true)] [string[]]$args