PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 21, 2022

[FIXED] What is the link between a nuget package and its source?

 November 21, 2022     c#, nuget, visual-studio     No comments   

Issue

In my company, NuGet packages are coming from different sources:

  • nuget.org (http://api.nuget.org/v3/index.json)
  • Microsoft Visual Studio Offline Packages (C:\Program files (x86)...\NuGetPackages)
  • Company_NuGetFeet@local (https://Company.pkgs.visualstudio.com/_packages/.../nuget/v2)
  • Supervision (some http://10.1.3.xxx/nuget site)

When I start up Visual Studio, I get logged in automatically (at the above right corner, I can see my login settings).

I have access to some NuGet packages and there are some where I don't have access to:

  • Company.Something.UA : OK
  • ControlzEx : OK
  • DevExpress.Chartsv18.2_Core : NOK

I have been doing NuGet restore in lots of ways: normal commandline, developer prompt, using the standard NuGet.exe, using the latest NuGet.exe, from within the company network, from outside the company network, ..., it does not make any difference.

In order to pinpoint the problem, I was thinking of restoring a single NuGet package, which should come from one specific package source, but what is that source?
When checking the properties of NuGet packages (being OK or not), the package source is not mentioned.

So I would like to do:

NuGet.exe restore DevExpress.Chartsv18.2_Core DevExpress..._Core_Package_Source
  • How can I do that?
  • How can I know from which package source I need to download a specific NuGet package?

Solution

There is no link. Package restore searches all sources in nuget.config (either system-defined or project-defined) for a package, in the order those sources are specified, and installs the first matching package it finds.

What you're really asking is "how do I install a package from a specific source", and you can do that with dotnet restore. Note that NuGet.exe is legacy and deprecated; its package restore functionality is integrated into the dotnet tool and improved there.

> dotnet restore MyPackage -s NugetSourceName

There is no way to know which source a package is available in without browsing it, but as stated above it shouldn't matter; package restore will figure it out.



Answered By - Ian Kemp
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing