Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The NuGet Explorer does not load NuGet packages from an Azure Artifacts feed. #589

Closed
SaffronSolid935 opened this issue Oct 19, 2023 · 15 comments · Fixed by #602
Closed

Comments

@SaffronSolid935
Copy link

Description

I have the problem that I cannot load NuGet packages from Azure Artifacts Feed. For this I took the URL that is generated for me when I want to connect to a feed (https://pkgs.dev.azure.com/<organization>/<project>/_packaging/<feed>/nuget/v3/index.json). Also, I put my of course login data in the nuget.config file. The PAT has access to the feed.
The nuget.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="NuGet" value="http://www.nuget.org/api/v2/" />
    <add key="<feedName>" value="https://pkgs.dev.azure.com/<organization>/<project>/_packaging/<feed>/nuget/v3/index.json" />
  </packageSources>
  <disabledPackageSources>
    <add key="NuGet" value="true" />
  </disabledPackageSources>
  <packageSourceCredentials>
    <feedName> <!--In my local file, the node name is the same as that entered under “<feed name>”-->
      <add key="userName" value="<myUsername>" />
      <add key="clearTextPassword" value="<pat>" />
    </feedName>
  </packageSourceCredentials>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
  <config>
    <add key="repositoryPath" value="./Packages" />
    <add key="DefaultPushSource" value="http://www.nuget.org/api/v2/" />
    <add key="verbose" value="true" />
    <add key="InstallFromCache" value="false" />
    <add key="ReadOnlyPackageFiles" value="false" />
  </config>
</configuration>

Here is the log:

Unable to retrieve package list from https://pkgs.dev.azure.com/<organization>/<project>/_packaging/<feed>/nuget/v3/index.jsonSearch()?$filter=IsLatestVersion&$orderby=DownloadCount desc&$skip=0&$top=15&searchTerm=''&targetFramework=''&includePrerelease=false
System.Net.WebException: The remote server returned an error: (404) Not Found.
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in <ef151b6abb5d474cb2c1cb8906a8b5a4>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in <ef151b6abb5d474cb2c1cb8906a8b5a4>:0 
  at NugetForUnity.NugetHelper.RequestUrl (System.String url, System.String userName, System.String password, System.Nullable`1[T] timeOut) [0x000e4] in <e385a841b2ca4c5a8d8a0c01b87bfe31>:0 
  at NugetForUnity.NugetPackageSource.GetPackagesFromUrl (System.String url, System.String username, System.String password) [0x00033] in <e385a841b2ca4c5a8d8a0c01b87bfe31>:0 
  at NugetForUnity.NugetPackageSource.Search (System.String searchTerm, System.Boolean includeAllVersions, System.Boolean includePrerelease, System.Int32 numberToGet, System.Int32 numberToSkip) [0x000db] in <e385a841b2ca4c5a8d8a0c01b87bfe31>:0 
UnityEngine.Debug:LogErrorFormat(String, Object[])
NugetForUnity.NugetPackageSource:Search(String, Boolean, Boolean, Int32, Int32)
NugetForUnity.NugetHelper:Search(String, Boolean, Boolean, Int32, Int32)
NugetForUnity.NugetWindow:UpdateOnlinePackages()
NugetForUnity.NugetWindow:Refresh(Boolean)
NugetForUnity.NugetWindow:DrawMandatoryButtons()
NugetForUnity.NugetWindow:DrawOnlineHeader()
NugetForUnity.NugetWindow:DrawOnline()
NugetForUnity.NugetWindow:OnGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

  • NuGetForUnity Version: 3.1.3
  • Unity Version: 2019.4.15f1
  • Operating System: Windows 11
@JoC0de
Copy link
Collaborator

JoC0de commented Oct 19, 2023

Hi,
You are using a nuget V3 API. In version 3.1.3 only nuget V2 API is supportet. In the current master also V3 API is supportet. But there is a bug that prevents Authenticated V3 APIs form working correctly, this will be fixed when I merge #585 you can try to use the beta build by the CI NuGetForUnity.3.1.4-dev.35+f511855.unitypackage

@SaffronSolid935
Copy link
Author

SaffronSolid935 commented Oct 20, 2023

Hey @JoC0de,
I tried both the unitypackage you sent me and the installation via the master branch (tutorial after the README: Install via Package Manager). It tells me that there is no specified API.

Here is the log:

There are no searchQueryServices specified in the API 'https://pkgs.dev.azure.com/<organization>/<project>/_packaging/<feed>/nuget/v3/index.json' so we can't search.
UnityEngine.Debug:LogError(Object)
NugetForUnity.PackageSource.<SearchPackage>d__8:MoveNext() (at Library/PackageCache/com.github-glitchenzo.nugetforunity@e10a179da5/Editor/PackageSource/NugetApiClientV3.cs:173)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(<SearchPackage>d__8&)
NugetForUnity.PackageSource.NugetApiClientV3:SearchPackage(NugetPackageSourceV3, String, Int32, Int32, Boolean, CancellationToken)
NugetForUnity.PackageSource.NugetPackageSourceV3:Search(String, Boolean, Int32, Int32, CancellationToken) (at Library/PackageCache/com.github-glitchenzo.nugetforunity@e10a179da5/Editor/PackageSource/NugetPackageSourceV3.cs:200)
NugetForUnity.PackageSource.NugetPackageSourceCombined:Search(String, Boolean, Int32, Int32, CancellationToken) (at Library/PackageCache/com.github-glitchenzo.nugetforunity@e10a179da5/Editor/PackageSource/NugetPackageSourceCombined.cs:202)
NugetForUnity.Configuration.ConfigurationManager:Search(String, Boolean, Int32, Int32, CancellationToken) (at Library/PackageCache/com.github-glitchenzo.nugetforunity@e10a179da5/Editor/Configuration/ConfigurationManager.cs:175)
NugetForUnity.Ui.<>c__DisplayClass51_0:<UpdateOnlinePackages>b__0() (at Library/PackageCache/com.github-glitchenzo.nugetforunity@e10a179da5/Editor/Ui/NugetWindow.cs:514)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

Is there already a solution for this problem or did I misunderstand that with the two versions mentioned it should already work with the V3 API?

@JoC0de
Copy link
Collaborator

JoC0de commented Oct 20, 2023

Is the content when you open the https://pkgs.dev.azure.com/<organization>/<project>/_packaging/<feed>/nuget/v3/index.json url in you Browser Similar to https://github.com/joelverhagen/data-nuget-service-index/blob/main/pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json ?
Especially the SearchQueryService part?
Than I need to add another fix.

@JoC0de
Copy link
Collaborator

JoC0de commented Oct 21, 2023

I changed the implementation in #585 and merged it so it should now work on the current master.

@JoC0de
Copy link
Collaborator

JoC0de commented Oct 22, 2023

I just released Version 4.0.0 it contains the fixes and hopefully should work now.

@SaffronSolid935
Copy link
Author

Ok, thanks! It works now. The newest is now the Version 4.0.1?
In any case: there is still the bug that we can't download older versions but only the latest version (Could not find BotUtility 1.8.0 or greater.), but temporarily I think this can be tolerated.

@JoC0de
Copy link
Collaborator

JoC0de commented Oct 23, 2023

Yes there was a compiler error in 4.0.0 so I released 4.0.1.
What do you mean with "can't download older versions"? Is it a dependency of another package that is not found? In the Upgrade tap there is now a "Downgrade" toggle that can be used to downgrade installed packages.

@SaffronSolid935
Copy link
Author

I mean, if I now want to use an older version of the package, because the new package has a bug, I have to install it via detours. Also, I noticed that this error occurs when I try to install an older version from Azure Artifacts. With the general NuGet Source it works without problems. Maybe the older package in my feed is not right.

@SaffronSolid935
Copy link
Author

Hey @JoC0de ,
I now have the problem that when I create a new NuGet package, it won't install. The error message I get here is:

Could not find BotUtility 1.9.0 or greater.
UnityEngine.Debug:LogErrorFormat(String, Object[])
NugetForUnity.NugetPackageInstaller:InstallIdentifier(INugetPackageIdentifier, Boolean, Boolean) (at Library/PackageCache/com.github-glitchenzo.nugetforunity@5a1e296804/Editor/NugetPackageInstaller.cs:39)
NugetForUnity.Ui.NugetWindow:DrawPackage(INugetPackage, GUIStyle, GUIStyle, Boolean) (at Library/PackageCache/com.github-glitchenzo.nugetforunity@5a1e296804/Editor/Ui/NugetWindow.cs:1095)
NugetForUnity.Ui.NugetWindow:DrawPackages(IEnumerable`1, Boolean) (at Library/PackageCache/com.github-glitchenzo.nugetforunity@5a1e296804/Editor/Ui/NugetWindow.cs:677)
NugetForUnity.Ui.NugetWindow:DrawOnline() (at Library/PackageCache/com.github-glitchenzo.nugetforunity@5a1e296804/Editor/Ui/NugetWindow.cs:642)
NugetForUnity.Ui.NugetWindow:OnGUI() (at Library/PackageCache/com.github-glitchenzo.nugetforunity@5a1e296804/Editor/Ui/NugetWindow.cs:293)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

FYI: Previously I assumed that it was working, but only tested this by installing a Package that a colleague created some while ago. As I had written, only the latest version seemed to be working for this. After I tried to do some troubleshooting installing/uninstalling the packages, I seem to now be unable to install any Packages from our artifact feed, as all attempts fail with the aforementioned error message.

@JoC0de
Copy link
Collaborator

JoC0de commented Oct 25, 2023

For me it looks like that the package you try to install has a dependency to BotUtility but this package doesn't exist.
Or what package do you try to install?

@SaffronSolid935
Copy link
Author

SaffronSolid935 commented Oct 26, 2023

@JoC0de
Unfortunately, this is not entirely true. I tried to install the package called BotUtility. Here are some meta data.
image
NuGet.org as source is not deactivated for me.

@JoC0de
Copy link
Collaborator

JoC0de commented Oct 26, 2023

  • So you can find the Package on the "Install" tab, but if you click install it fails to install the package? But other packages on the same Registry (Azure Artifacts feed) can be found / installed?
  • What happens if you type packageid:BotUtility in the search bar of the "Install" tab, can you find the package?
  • Do you get more information if you enable Verbose Logging inside the NugetForUnity settings
  • Even if you where able to download the package BotUtility it seems outdated / incompatible with Unity as it only lists .net core 3.1 as a target framework. Normally you need to target .net standard 2.0 or 2.1 to get a .dll / NuGet package that is compatible with Unity see Unity doc about dotnet profile support

@SaffronSolid935
Copy link
Author

@JoC0de

  1. The packages can be found in the online tab and non of them in the installed tab. But I can't install any of these custom packages.

  2. No package is displayed:
    Online Tab:
    image
    Installed Tab:
    image

  3. No, I do not get more information with Verbose Logging enabled.

  4. I will try to change that in my Package, but with .NET Framework 4.8 because the projects Api Compatibility Level is setted to .NET 4.x .

@SaffronSolid935
Copy link
Author

@JoC0de Sorry, there was a Log, which I didn't see:

Plug-in loaded for file: Assets/NuGet.config
Searching 'BotUtilit' in all active package sources returned: 0 packages after 10634 ms
Searching 'BotUtili' in all active package sources returned: 0 packages after 11949 ms
Searching 'BotUtili' in all active package sources returned: 0 packages after 11949 ms
Searching 'BotUtil' in all active package sources returned: 3 packages after 10951 ms
Searching 'BotUtil' in all active package sources returned: 4 packages after 606 ms
Failed to find BotUtility 1.9.0

That was the log for the BotUtility Package.
Now the log for a Package, which is in .net standart 2.0, .net standart 2.1 & .net Framework 4.8:

Searching 'UnityAssetLoader' in all active package sources returned: 2 packages after 11217 ms
Failed to find SemanticServices.UnityAssetLoader 1.0.5 // I tried to download this Version.

@JoC0de
Copy link
Collaborator

JoC0de commented Oct 29, 2023

@SaffronSolid935 thanks for the details. We currently relay on the packageid:BotUtility syntax to only return the single NuGet package BotUtility. We need to implement a different way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants