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

-source argument is being ignored when installing a local nuget package into a .net core project. #5763

Closed
michaelrenvl opened this issue Aug 16, 2017 · 11 comments
Assignees
Milestone

Comments

@michaelrenvl
Copy link

michaelrenvl commented Aug 16, 2017

Remove the content above here and fill out details below.

Details about Problem

NuGet product used (Package Manager Console):

NuGet version (4.3.0.4339):

dotnet.exe --version (if appropriate): .net core 1.1

VS version (if appropriate): 15.3.0

OS version (win10 v1703 (15063.540)):

Worked before? If so, with which NuGet version: The version before the visual studio update that brought .net core 2.0.

Detailed repro steps so we can see the same problem

These steps assume that there is a .net core 1.1 project currently loaded in Visual studio 2017 with the update that brought .net core 2.0.

  1. Create a nuget package from a project (in my case a .net core class library targeting core 1.1 configured to output a nuget package).

  2. Do NOT upload this to any server, instead copy it to a local folder from which you will manually install this in a .net core project.

  3. In the project that gets the package installed use this command: "Install-Package -Source ". It fails with the message that it can't locate the source.

  4. Add that path to the NuGet package manager settings and install the package again using the same command.

  5. The installation will succeed and that path can be safely removed from the settings.

  6. Increase the version number of the package and build it again. But without adding the path to the settings.

  7. If you try to install the package now it will fail with the message that it can't find the path.

  8. Add that path to the settings and it will be able to install the package again until you remove it from the settings and increase the version number.

Suggested things

It looks like it is ignoring the -Source parameter.

Verbose Logs

Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)

Restoring packages for
...
GET https://api.nuget.org/v3-flatcontainer/nugetpackage/index.json
GET https://nuget.renvl.nl/api/odata/FindPackagesById()?id='NuGetPackage'
OK https://nuget.renvl.nl/api/odata/FindPackagesById()?id='NuGetPackage' 70ms
NotFound https://api.nuget.org/v3-flatcontainer/nugetpackage/index.json 471ms
Install-Package : Unable to find package NuGetPackage. No packages exist with this id in source(s): C:\Program Files\dotnet\sdk\NuGetFallbackFolder, Microsoft Visual Studio Offline Packages, nuget.org, RvlLibrary
At line:1 char:1

  • Install-Package NuGetPackage -Source ...
  •   + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
      + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
    
    

Install-Package : Package restore failed. Rolling back package changes for 'Project'.
At line:1 char:1

  • Install-Package NuGetPackage -Source ...
  •   + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
      + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
    
    
@anangaur
Copy link
Member

cc: @rrelyea @nkolev92 Is this related to #5704 by any chance?

@nkolev92
Copy link
Member

@anangaur It's not related. When using -source the config files are not read, which is the at the root of the #5704

@jainaashish
Copy link
Contributor

@michaelrenvl can you tell us the complete command you used to install the package?

@michaelrenvl
Copy link
Author

@jainaashish the complete command was: Install-Package SomeLocalPackage -Source C:\Users\Michael\Documents\Visual Studio 2017\Projects\LocalNuGet

@bgribaudo
Copy link

I have also encountered where -Source seems to be ignored using the same NuGet version (4.3.0.4339), though in VS 15.3.1 and dotnet core 2.0.0.

For example, in the package manager console, executing Install-Package xunit -Version 2.3.0-beta5-build3754 -Source https://www.myget.org/F/xunit/api/v3/index.json produces the below output.

Notice how line 2 reflects a call to nugget.org instead of myget.org, as was requested by -Source.

Restoring packages for C:\Path\To\Project\Example\Example.csproj...
  GET https://api.nuget.org/v3-flatcontainer/xunit/index.json
  OK https://api.nuget.org/v3-flatcontainer/xunit/index.json 512ms
Install-Package : Unable to find package xunit with version (>= 2.3.0-beta5-build3754)
  - Found 57 version(s) in nuget.org [ Nearest version: 2.3.0-beta4-build3742 ]
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in C:\Program Files\dotnet\sdk\NuGetFallbackFolder
  - Found 0 version(s) in CliFallbackFolder
At line:1 char:1
+ Install-Package xunit -Version 2.3.0-beta5-build3754 -Source https:// ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
 
Install-Package : Package restore failed. Rolling back package changes for 'Example'.
At line:1 char:1
+ Install-Package xunit -Version 2.3.0-beta5-build3754 -Source https:// ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
 
Time Elapsed: 00:00:02.1320266

@nkolev92
Copy link
Member

nkolev92 commented Sep 5, 2017

I've tested this with 4.0.0 and the behavior has not changed, so it's not a new regression.

The behavior is the same among package reference (both legacy and netcore) and project.json projects.

@pi3k14
Copy link

pi3k14 commented Dec 15, 2017

I can confirm the problem, when using Nuget Package Manager Console in VS 2017 15.4.4 the -Source option or full path to nuget package wasn't respected. Instead NuGet searched all my registered repos.
Upgrading to VS 2017 15.5.1, NuGet 4.5.0 fixed the problem.
My project was a net standard library.

@bonesoul
Copy link

same here.

@Mike-E-angelo
Copy link

I'm wanting to provide users that submit issues to our repository an easy and simple way to install a new package generated by our CI that addresses the issue they are reporting.

Example:

https://github.com/ExtendedXmlSerializer/ExtendedXmlSerializer/pull/299#issuecomment-556035632

However, running the command results in the error message discussed in this issue. The interesting thing is that I was able to run it once on a clean project (that's how I got the command in the first place 😁) but now it generates the error after it has been installed.

@SuperJMN
Copy link

I'm getting this into the Package Manager Console

Install-Package ExtendedXmlSerializer -Version 3.0.2.1-uypiabac -Source https://ci.appveyor.com/nuget/extendedxmlserializer-preview

image

Shouldn't it install it from the given source?

@zkat
Copy link
Contributor

zkat commented Mar 13, 2020

This is intentional and by design. After some discussion among the team, we've decided to keep things as they are. Thank you for your time filing this issue and for the healthy ongoing discussion!

@zkat zkat closed this as completed Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants