aliasadidev / vscode-npm-gui

vscode nuget package manager gui https://marketplace.visualstudio.com/items?itemName=aliasadidev.nugetpackagemanagergui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

private nuget feed with authorization

arwyl opened this issue · comments

commented

Hi!

Can one somehow see packages from nuget private feed in nuget package manager GUI?

I've added custom source with user\pass to nuget.config, added this source via nuget sources add, via dotnet nuget sources add, added the url in npm gui settings, but tha packages are not shown.. Is there a way to see them?

Hi,
Yes, you can set your private repo.
check the #15

commented

thanks a lot, i'll try that on monday and close the issue if it helps!

commented

tried that but did not succeed =(

there is source https://nuget.pkg.github.com/MYCOMPANY/index.json in ~/.nuget/Nuget/NuGet.Config with username and password

vs code settings:

"nugetpackagemanagergui.nuget.searchPackage.urls": [
    "https://azuresearch-usnc.nuget.org/query",
    "https://nuget.pkg.github.com/MYCOMPANY/query"
],
"nugetpackagemanagergui.nuget.packageVersionsUrls": [
    "https://api.nuget.org/v3-flatcontainer/{{packageName}}/index.json",
    "https://nuget.pkg.github.com/MYCOMPANY/download/{{packageName}}/index.json"
],

i've tested those urls and they return the same data as nuget ones

but when I try to search something in npm gui i get

[Extension Host] [Nuget Package Manager GUI => ERROR!!!][Request to url:https://nuget.pkg.github.com/MYCOMPANY/query?q=PACKAGE&prerelease=false&semVerLevel=2.0.0&skip=0&take=10][timeout:9000][proxy is active:false][result:]

the same url opens in browser correctly

i've even added source :https://nuget.pkg.github.com/MYCOMPANY/query in nuget config - same results..

UPD: command

nuget search MYPACKAGE

works fine

I have to add the authorization header to the requests, I will change the extension setting :-)

"nugetpackagemanagergui.nuget.packageVersionsUrls": {
"type": [
"array",
"string"
],
"default": [
"https://api.nuget.org/v3-flatcontainer/{{packageName}}/index.json"
],
"description": "The NuGet endpoint addresses for getting package versions (The first address in the list has highest priority)\n The {{packageName}} property inject by extension"
},
"nugetpackagemanagergui.nuget.searchPackage.urls": {
"type": [
"array",
"string"
],
"default": [
"https://azuresearch-usnc.nuget.org/query"
],
"description": "The NuGet endpoint addresses for searching packages (The first address in the list has highest priority)"
},

we need something like this

  nugetpackagemanagergui.nuget.repos": [
    { 
       repoType:"local/remote", -- enum 
       repoName:"GitHub", -- string
       searchUrl:"", -- string
       packageMetadataUrl:"", -- string
       authorization:{
            authType:"Basic Auth", -- enum
            username:"", -- string
            password:"" -- string
      }
   ]
           

Thank you again 👍

We have the nuget.config pointing to Jfrog Artifactory on top level in the repo, which works for example in VS:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="ArtifactoryCloud" value="https://artifactory-rxxxxapp.azure.com/artifactory/api/nuget/xxx-nuget-dev" />
  </packageSources>
  <packageSourceCredentials>
    <ArtifactoryCloud>
        <add key="Username" value="robotics.service@xxxx.com" />
        <add key="ClearTextPassword" value="AKCp5xxxxWPUvKRJtRNHfxxxxxxxxnvWMR66bRAxXjgUH" />
      </ArtifactoryCloud>
  </packageSourceCredentials>
</configuration>

In the config I added:

"nugetpackagemanagergui.nuget.searchPackage.urls": [
	    "https://azuresearch-usnc.nuget.org/query",
	    "https://artifactory-rxxxxapp.azure.com/artifactory/api/nuget/xxx-nuget-dev"
    ],
    "nugetpackagemanagergui.nuget.packageVersionsUrls": [
	    "https://api.nuget.org/v3-flatcontainer/{{packageName}}/index.json",
	    "https://artifactory-rxxxxapp.azure.com/artifactory/api/nuget/xxx-nuget-dev"
    ]

However, when trying to load packages, it says

[An error occurred in the loading package versions (package:xxxxx.WebApps.Swagger)] request to https://artifactory-rxxxxapp.azure.com/artifactory/api/nuget/xxx-nuget-dev failed, reason: certificate has expired

The same error occured when deleting the root level nuget.config, leaving only the one in AppData/Roaming/Nuget.

The certificate problem could be solved by setting "http.systemCertificates": false in the settings.
Also I adapted the settings in the following way. However, when I try to load versions now, nothing happens. When I remove private packages, it works just fine. I also tried to add base auth to that Urls, without success...

"nugetpackagemanagergui.nuget.searchPackage.urls": [
    "https://azuresearch-usnc.nuget.org/query",
    "https://artifactory-rxxxxapp.azure.com/artifactory/api/nuget/xxx-nuget-dev/query"
],
"nugetpackagemanagergui.nuget.packageVersionsUrls": [
    "https://api.nuget.org/v3-flatcontainer/{{packageName}}/index.json",
    "https://artifactory-rxxxxapp.azure.com/artifactory/api/nuget/xxx-nuget-dev/v3-flatcontainer/{{packageName}}/index.json"
]

@arwyl
@Kiechlus
@m4ss1m0g
Good news: after 4 months!!! finally, I found some free time to add the private registry.
I tested in Azure (works fine), I need some time to test it in GitHub/GitLab/JFrog registries.