aspire icon indicating copy to clipboard operation
aspire copied to clipboard

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

Open afscrome opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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>
  1. 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

afscrome avatar Oct 04 '24 15:10 afscrome

cc @joperezr

radical avatar Oct 04 '24 16:10 radical

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".

davidfowl avatar Oct 05 '24 04:10 davidfowl

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.)

afscrome avatar Oct 06 '24 17:10 afscrome

cc @DamianEdwards

davidfowl avatar Oct 30 '24 04:10 davidfowl

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..

DamianEdwards avatar Oct 30 '24 14:10 DamianEdwards

Closing given the above. @afscrome feel free to reopen if you think we should do something different here.

joperezr avatar Jan 07 '25 19:01 joperezr