dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.94k stars 482 forks source link

Add .Net Aspire package doesn't work if using Azure Devops nuget feed #6110

Open afscrome opened 1 month ago

afscrome commented 1 month ago

Is there an existing issue for this?

Describe the bug

If your primary nuget feed is an Azure Artifacts feed, the Add > .Net Aspire package option in VS doesn't find any results image

image

According to https://learn.microsoft.com/en-us/nuget/consume-packages/finding-and-choosing-packages#search-syntax, the search syntax is specific to nuget.org, and is not guaranteed to work with other feed providers.

Expected Behavior

Some packages should be listed

Steps To Reproduce

  1. Have a nuget.config pointing to an ADO feed with nuget.org as an upstream
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <packageSources>
        <clear />
        <add key="ADO" value="https://pkgs.dev.azure.com/ORG/_packaging/FEED/nuget/v3/index.json" />
    </packageSources>
    </configuration>
  2. In an AppHost project right click the project > Add > .Net Aspire package image

Exceptions (if any)

No response

.NET Version info

Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.11.2

.NET SDK:
 Version:           8.0.401
 Commit:            811edcc344
 Workload version:  8.0.400-manifests.2772ffde
 MSBuild version:   17.11.4+37eb419ad

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.401\

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
 [aspire]
   Installation Source: SDK 8.0.400, VS 17.11.35222.181
   Manifest Version:    8.2.1/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.1\WorkloadManifest.json
   Install Type:        FileBased

Host:
  Version:      8.0.8
  Architecture: x64
  Commit:       08338fcaa5

.NET SDKs installed:
  6.0.425 [C:\Program Files\dotnet\sdk]
  8.0.400 [C:\Program Files\dotnet\sdk]
  8.0.401 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Anything else?

No response

radical commented 1 month ago

cc @joperezr

davidfowl commented 1 month ago

This is by design. Aspire packages are owned by the aspire account (on nuget.org). Is this a mirroring scenario? Or are you building your own "aspire packages".

afscrome commented 1 month ago

This is essentially a mirroring scenario. Azure Artifacts recommendation is that you only include a single feed in your nuget.config. In particular you should point that to only your Azure Artifacts feed, then configure nuget.org as an upstream of that feed - https://learn.microsoft.com/en-us/azure/devops/artifacts/concepts/upstream-sources?view=azure-devops#use-a-single-feed-in-your-config-file

To be clear, the bug report is not about the filtering to just aspire owned packages - the bug is that the search syntax assumes the feed is configured to nuget.org. The query syntax used is not guaranteed to work with non nuget.org feeds. In particular it doesn't work with Azure Artifacts.)

davidfowl commented 1 month ago

cc @DamianEdwards

DamianEdwards commented 1 month ago

Yep this is a known limitation of how the filter applied to the NuGet Package Manager UI works. We could consider changing the filter when nuget.org is not the configured feed to remove the owner constraint and instead add another tag constraint, e.g. tags:aspire+integration+hosting but that may not work either as I don't believe AzDO artifacts feeds fully implement the NuGet search API. From reading their documentation and my own experience using it, I think they only support partial name matching. With the addition of the Aspire Community Toolkit, not all curated packages have the same prefix so I'm not sure it's even possible to create a filter that would show all packages with a name prefix of either Aspire. or CommunityToolkit.Aspire..