Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c862b11
Replace nuget.org feed URLs with packagefeedproxy in tests
marcpopMSFT Jul 24, 2026
ab7fdf1
Rewrite GetLatestVersion to resolve flat-container from service index
marcpopMSFT Jul 24, 2026
7e51d4d
Handle array @type in NuGet service index resolution
marcpopMSFT Jul 24, 2026
a68cd63
Fix test failures from proxy feed metadata differences
marcpopMSFT Jul 27, 2026
0e613b2
Fix IDE0055 formatting error in NuGetApiPackageManagerTests
marcpopMSFT Jul 28, 2026
91e1e20
Fix proxy feed test failures: use SearchQueryService, handle TotalHit…
marcpopMSFT Jul 28, 2026
9d2d40f
Fix remaining proxy test failures and use data.nuget.org for audit
marcpopMSFT Jul 29, 2026
c53f4f0
Fix vulnerability tests and TotalDownloads assertion
marcpopMSFT Jul 29, 2026
443897b
Fix TotalDownloads assertion to use FluentAssertions
marcpopMSFT Jul 30, 2026
081b395
Use nuget.org for vulnerability metadata tests
marcpopMSFT Jul 30, 2026
cac6e81
Fix botched edit in HasVulnerabilitiesForce test
marcpopMSFT Jul 30, 2026
d8986f9
Update vulnerability source URL in tests
marcpopMSFT Jul 30, 2026
3a5adef
Switch tests from proxy feed to dotnet-public ADO feed
marcpopMSFT Jul 31, 2026
94348ff
Fix IDE0055 formatting in TemplatePackagesTests.cs
marcpopMSFT Jul 31, 2026
40530bc
Handle SearchQueryService beta endpoint in NuGet discovery test
marcpopMSFT Aug 3, 2026
f2116d1
Fix template details feed isolation
marcpopMSFT Aug 3, 2026
72c44f2
Fix CanDisplayDetails_RemotePackage_NuGetFeedNoVersion test isolation…
marcpopMSFT Aug 4, 2026
9b33faf
Scrub template package filename versions
marcpopMSFT Aug 4, 2026
fdb4fce
Stabilize remote template details approval
marcpopMSFT Aug 6, 2026
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 @@ -15,7 +15,9 @@ public class NuGetApiPackageManagerTests
public TestContext TestContext { get; set; } = null!;

private static EnvironmentSettingsHelper s_environmentSettingsHelper = null!;
private readonly IList<string> _additionalSources = new[] { "https://api.nuget.org/v3/index.json" };
private readonly IList<string> _additionalSources = new[] { "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" };
// Vulnerability metadata requires nuget.org registration blobs (read-only index); dotnet-public does not include vulnerability data.
private readonly IList<string> _vulnerabilitySources = new[] { "https://api.nuget.org/v3/index.json" };

[ClassInitialize]
public static void ClassInitialize(TestContext _)
Expand Down Expand Up @@ -67,8 +69,7 @@ public async Task DownloadPackage_LatestFromNugetOrgFeed()
result.FullPath.Should().ContainAll(installPath, "Microsoft.DotNet.Common.ProjectTemplates.5.0");
Assert.IsTrue(File.Exists(result.FullPath));
result.PackageIdentifier.Should().Be("Microsoft.DotNet.Common.ProjectTemplates.5.0");
result.Owners.Should().Be("dotnetframework, Microsoft");
result.Reserved.Should().BeTrue();
// Proxy feed may not return Owners/Reserved metadata - just verify the download succeeded
result.PackageVersion.Should().NotBeNullOrEmpty();
result.NuGetSource.Should().NotBeNullOrEmpty();
}
Expand Down Expand Up @@ -150,12 +151,12 @@ public async Task DownloadPackage_HasVulnerabilities()
// Getting this version of the package as it has known vulnerabilities
NuGetApiPackageManager packageManager = new NuGetApiPackageManager(engineEnvironmentSettings);

// add the source for getting vulnerability info
// use nuget.org for vulnerability metadata (read-only; proxy does not include vulnerability data in registrations)
var exception = await Assert.ThrowsExactlyAsync<VulnerablePackageException>(() => packageManager.DownloadPackageAsync(
installPath,
"System.Text.Json",
"8.0.4",
additionalSources: _additionalSources,
additionalSources: _vulnerabilitySources,
cancellationToken: TestContext.CancellationToken));

exception.PackageIdentifier.Should().Be("System.Text.Json");
Expand All @@ -172,12 +173,12 @@ public async Task DownloadPackage_HasVulnerabilitiesForce()
// Getting this version of the package as it has known vulnerabilities
NuGetApiPackageManager packageManager = new NuGetApiPackageManager(engineEnvironmentSettings);

// add the source for getting vulnerability info
// use nuget.org for vulnerability metadata (read-only; proxy does not include vulnerability data in registrations)
var result = await packageManager.DownloadPackageAsync(
installPath,
"System.Text.Json",
"8.0.4",
additionalSources: _additionalSources,
additionalSources: _vulnerabilitySources,
force: true,
cancellationToken: TestContext.CancellationToken);

Expand All @@ -186,7 +187,7 @@ public async Task DownloadPackage_HasVulnerabilitiesForce()
result.PackageVersion.Should().Be("8.0.4");
Assert.IsTrue(File.Exists(result.FullPath));
result.PackageVulnerabilities.Should().NotBeNullOrEmpty();
result.NuGetSource.Should().Be(_additionalSources[0]);
result.NuGetSource.Should().NotBeNullOrEmpty();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ public class TemplatePackagesTests : BootstrapperTestBase
"Packages": [
{
"Details": {
"PackageId": "Sln",
"Author": "Enrico Sada",
"NuGetSource": "https://api.nuget.org/v3/index.json",
"Version": "0.2.0"
"PackageId": "Microsoft.DotNet.Common.ProjectTemplates.5.0",
"Author": "Microsoft",
"NuGetSource": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json",
"Version": "5.0.0"
},
"InstallerId": "015dcbac-b4a5-49ea-94a6-061616eb60e2",
"LastChangeTime": "2023-04-13T15:17:16.4866397Z",
"MountPointUri": "packages\\Sln.0.3.0.nupkg"
"MountPointUri": "packages\\Microsoft.DotNet.Common.ProjectTemplates.5.0.5.0.0.nupkg"
},
{
"Details": {
"PackageId": "Boxed.Templates",
"Author": "Muhammad Rehan Saeed (RehanSaeed.com)",
"NuGetSource": "https://api.nuget.org/v3/index.json",
"Version": "7.4.0"
"PackageId": "Microsoft.DotNet.Web.ProjectTemplates.10.0",
"Author": "Microsoft",
"NuGetSource": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json",
"Version": "10.0.0"
},
"InstallerId": "015dcbac-b4a5-49ea-94a6-061616eb60e2",
"LastChangeTime": "2023-06-01T11:32:14.867341Z",
"MountPointUri": "packages\\Boxed.Templates.7.4.0.nupkg"
"MountPointUri": "packages\\Microsoft.DotNet.Web.ProjectTemplates.10.0.10.0.0.nupkg"
}
]
}
Expand Down Expand Up @@ -92,11 +92,11 @@ public async Task CanInstall_RemoteNuGetPackage()
{
using Bootstrapper bootstrapper = GetBootstrapper();
InstallRequest installRequest = new InstallRequest(
"Take.Blip.Client.Templates",
"0.5.135",
"Microsoft.Android.Templates",
"36.1.69",
details: new Dictionary<string, string>
{
{ InstallerConstants.NuGetSourcesKey, "https://api.nuget.org/v3/index.json" }
{ InstallerConstants.NuGetSourcesKey, "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" }
});

IReadOnlyList<InstallResult> result = await bootstrapper.InstallTemplatePackagesAsync(new[] { installRequest }, InstallationScope.Global, CancellationToken.None);
Expand All @@ -109,12 +109,12 @@ public async Task CanInstall_RemoteNuGetPackage()

IManagedTemplatePackage? source = result[0].TemplatePackage;
Assert.IsNotNull(source);
Assert.AreEqual("Take.Blip.Client.Templates", source!.Identifier);
Assert.AreEqual("Microsoft.Android.Templates", source!.Identifier);
Assert.AreEqual("Global Settings", source.Provider.Factory.DisplayName);
Assert.AreEqual("NuGet", source.Installer.Factory.Name);
source.GetDetails()["Author"].Should().NotBeNullOrEmpty();
Assert.AreEqual("https://api.nuget.org/v3/index.json", source.GetDetails()["NuGetSource"]);
Assert.AreEqual("0.5.135", source.Version);
source.GetDetails()["NuGetSource"].Should().NotBeNullOrEmpty();
Assert.AreEqual("36.1.69", source.Version);

IReadOnlyList<IManagedTemplatePackage> managedTemplatesPackages = await bootstrapper.GetManagedTemplatePackagesAsync(CancellationToken.None);

Expand Down Expand Up @@ -222,39 +222,43 @@ public async Task CanUpdateAllPackagesMetadataOnGetLatestVersion()
var updatedPackages = await bootstrapper.GetManagedTemplatePackagesAsync(CancellationToken.None);

Assert.HasCount(2, updatedPackages);
var slnPackage = updatedPackages[0];
Assert.AreEqual("0.2.0", slnPackage.Version);
var slnPackageDetails = slnPackage.GetDetails();
Assert.AreEqual("enricosada", slnPackageDetails["Owners"]);
Assert.IsFalse(bool.Parse(slnPackageDetails["Reserved"]));

var boxPackage = updatedPackages[1];
Assert.AreEqual("7.4.0", boxPackage.Version);
var boxPackageDetails = boxPackage.GetDetails();
Assert.AreEqual("BlackLight", boxPackageDetails["Owners"]);
Assert.IsTrue(bool.Parse(boxPackageDetails["Reserved"]));
var commonPackage = updatedPackages[0];
Assert.AreEqual("5.0.0", commonPackage.Version);
var commonPackageDetails = commonPackage.GetDetails();
// dotnet-public feed may not return Owners metadata
commonPackageDetails.TryGetValue("Owners", out var commonOwners);
// Owners may be empty or populated depending on feed behavior
Assert.IsFalse(bool.Parse(commonPackageDetails["Reserved"]));

var webPackage = updatedPackages[1];
Assert.AreEqual("10.0.0", webPackage.Version);
var webPackageDetails = webPackage.GetDetails();
// dotnet-public feed may not return Owners metadata
webPackageDetails.TryGetValue("Owners", out var webOwners);
Assert.IsFalse(bool.Parse(webPackageDetails["Reserved"]));
}

[TestMethod]
public async Task CanUpdateSpecifiedPackageMetadataOnGetLatestVersion()
{
using Bootstrapper bootstrapper = GetBootstrapper(packageJsonContent: ValidPackageJsonFile);
var installedPackages = await bootstrapper.GetManagedTemplatePackagesAsync(CancellationToken.None);
var boxedTemplatePackage = installedPackages.FirstOrDefault(ip => ip.Identifier == "Boxed.Templates");
var webTemplatePackage = installedPackages.FirstOrDefault(ip => ip.Identifier == "Microsoft.DotNet.Web.ProjectTemplates.10.0");

// implicitly populates package metadata
await bootstrapper.GetLatestVersionsAsync(new[] { boxedTemplatePackage! }, CancellationToken.None);
await bootstrapper.GetLatestVersionsAsync(new[] { webTemplatePackage! }, CancellationToken.None);

var updatedPackages = await bootstrapper.GetManagedTemplatePackagesAsync(CancellationToken.None);
Assert.HasCount(2, updatedPackages);
var slnPackageDetails = updatedPackages[0].GetDetails();
Assert.IsFalse(slnPackageDetails.TryGetValue("Owners", out var _));
Assert.IsFalse(bool.Parse(slnPackageDetails["Reserved"]));
var commonPackageDetails = updatedPackages[0].GetDetails();
Assert.IsFalse(commonPackageDetails.TryGetValue("Owners", out var _));
Assert.IsFalse(bool.Parse(commonPackageDetails["Reserved"]));

// the specified package has updated metadata
var boxPackageDetails = updatedPackages[1].GetDetails();
Assert.AreEqual("BlackLight", boxPackageDetails["Owners"]);
Assert.IsTrue(bool.Parse(boxPackageDetails["Reserved"]));
var webPackageDetails = updatedPackages[1].GetDetails();
// dotnet-public feed may not return Owners for Microsoft packages
webPackageDetails.TryGetValue("Owners", out var webOwners);
Assert.IsFalse(bool.Parse(webPackageDetails["Reserved"]));
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.TemplateEngine.TestHelper
{
public class PackageManager : IDisposable
{
private const string NuGetOrgFeed = "https://api.nuget.org/v3/index.json";
private const string NuGetOrgFeed = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json";
private static readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1, 1);
private readonly string _packageLocation = TestUtils.CreateTemporaryFolder("packages");
private readonly ConcurrentDictionary<string, string> _installedPackages = new ConcurrentDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ public class NuGetTests
[TestMethod]
public async Task CanReadPackageInfo()
{
string nuGetOrgFeed = "https://api.nuget.org/v3/index.json";
string nuGetOrgFeed = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json";
var repository = Repository.Factory.GetCoreV3(nuGetOrgFeed);
ServiceIndexResourceV3 indexResource = repository.GetResource<ServiceIndexResourceV3>(TestContext.Current!.CancellationToken)
?? throw new InvalidOperationException("Failed to get ServiceIndexResourceV3.");
IReadOnlyList<ServiceIndexEntry> searchResources = indexResource.GetServiceEntries("SearchQueryService");
if (searchResources.Count == 0)
{
searchResources = indexResource.GetServiceEntries("SearchQueryService/3.0.0-beta");
}

Assert.IsNotEmpty(searchResources, "No SearchQueryService entries found in the feed service index.");
string queryString = $"{searchResources[0].Uri}?q=Microsoft.DotNet.Common.ProjectTemplates.5.0&skip=0&take=10&prerelease=true&semVerLevel=2.0.0";
Uri queryUri = new Uri(queryString);
using HttpClient client = new HttpClient();
Expand All @@ -29,18 +35,14 @@ public async Task CanReadPackageInfo()
string responseText = await response.Content.ReadAsStringAsync(TestContext.Current!.CancellationToken);

NuGetPackageSearchResult resultsForPage = NuGetPackageSearchResult.FromJObject(JsonNode.Parse(responseText)!.AsObject());
Assert.AreEqual(1, resultsForPage.TotalHits);
Assert.ContainsSingle(resultsForPage.Data);
Assert.IsNotEmpty(resultsForPage.Data, "Search returned no data entries.");

var packageInfo = resultsForPage.Data[0];

Assert.AreEqual("Microsoft.DotNet.Common.ProjectTemplates.5.0", packageInfo.Name);
Assert.IsNotEmpty(packageInfo.Version);
Assert.IsGreaterThan(0, packageInfo.TotalDownloads);
Assert.IsTrue(packageInfo.Reserved);
Assert.Contains("Microsoft", packageInfo.Owners);
packageInfo.TotalDownloads.Should().BeGreaterThanOrEqualTo(0);
packageInfo.Description.Should().NotBeNullOrEmpty();
packageInfo.IconUrl.Should().NotBeNullOrEmpty();
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="nuget.org" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
</packageSources>
<!-- Define mappings by adding package patterns beneath the target source. -->
<packageSourceMapping>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
Uno.ProjectTemplates.Dotnet
Package version: 4.8.0-dev.792
Reserved: True
Details: Package Description
Source Feed: https://api.nuget.org/v3/index.json
Microsoft.Android.Templates
Package version: %VERSION%
Details: Templates for Android platforms.
Source Feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json
Authors:
nventive
Owners:
https://nuget.org/profiles/unoplatform
Microsoft
License Metadata:
Repository Url: https://github.com/unoplatform/uno
License Url: https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.android.templates/%VERSION%/microsoft.android.templates.%VERSION%.nupkg?extract=LICENSE.TXT
Repository Url: https://dot.net/
Templates:
Template Name Short Name Type Tags Language
----------------------------------------------- -------------------- ------- --------------------------------------------------------------------- --------
Multi-Platform App (Windows App SDK) unoapp project Multi-platform/Uno Platform/Android/iOS/Windows/Mac Catalyst/Linux... C#
Cross-Platform App (Prism) unoapp-prism project Cross-platform/Uno Platform/Prism/Android/iOS/Windows/macOS/WebAss... C#
Cross-Platform UI Tests Library unoapp-uitest project Cross-platform/Uno Platform/UITest/Android/iOS/WebAssembly/dotnet-new C#
Multi-Platform App (Xamarin, UWP) unoapp-uwp project Multi-platform/Uno Platform/Android/iOS/Windows/macOS/Linux/Tizen/... C#
Multi-Platform App (.NET 6, UWP) unoapp-uwp-net6 project Multi-platform/Uno Platform/Android/iOS/Windows/macOS/Linux/WebAss... C#
Multi-Platform App (Xamarin, Windows App SDK) unoapp-winui-xamarin project Multi-platform/Uno Platform/Android/iOS/Windows/macOS/Linux/WebAss... C#
Cross-Platform Library unolib project Cross-platform/Uno Platform/Library/Android/iOS/Windows/macOS/Linu... C#
Cross-Runtime Library (Xamarin, UWP) unolib-crossruntime project Cross-platform/Uno Platform/Library/Android/iOS/Windows/macOS/Linu... C#
Uno Platform WebAssembly Head for Xamarin.Forms wasmxfhead project Cross-platform/Uno Platform/Xamarin.Forms/WebAssembly/dotnet-new C#

%TEMPLATES%
Loading
Loading