Home: The 'Source' parameter is not respected for the transitive package management based project(s)

Created on 9 Aug 2018  路  20Comments  路  Source: NuGet/Home

Details about Problem

NuGet product used: Package Manager Console

NuGet Package Manager Host version: 4.7.0.5212

dotnet.exe --version: 2.1.302

VS version: 15.7.5

OS version: Microsoft Windows [Version 10.0.14393]

Detailed repro steps so we can see the same problem

PM> Install-Package AutoMapper.Collection.EntityFrameworkCore -Version 0.1.0-ci-00003 -Source https://www.myget.org/F/automapperdev/api/v3/index.json

The following error appears
The 'Source' parameter is not respected for the transitive package management based project(s) My.Project.Namespace. The enabled sources in your NuGet configuration will be used.
and the install fails.

Adding https://www.myget.org/F/automapperdev/api/v3/index.json as a nuget feed for VS works as a workaround, but I don't want to do that. I want to use this source for this nuget package only and ensure that my coworkers do not have to configure their VS in order to build the project.

Icebox 3 VS.PMConsole Feature

Most helpful comment

@JimBobSquarePants agreed but it's a PITA for local testing since you end up having to put a physical path in the NuGet.Config. That's fine if the repo is a throw away for testing but not something to check into source control.

@weitzhandler What happens if you have dependencies on other packages that aren't on nuget feeds? There are several issues with local package development that makes things painful for fast iteration:

  • Package versions need to be revved every build to avoid getting the cached version on install
  • The a pseudo local feed of each project needs to be added (unless you build all packages to the same output location).

All 20 comments

This behavior is really annoying, I'm surprised it's not getting enough attention.

I personally get the same warning message but the Source parameter is actually taken into account.

If I delete my package source from my Nuget feeds list in VS options and then run the command Install-Package "PrivatePackageName" it fails (as expected).
But if I run Install-Package "PrivatePackageName" -Source "PrivateNugetFeedURL" I get the warning message but it actually works.

Package Manager Console Host Version 4.8.1.5435
Visual Studio version 15.8.9

I have the same issue...

@karann-msft all MyGet packages suggest this command-line setup to add private packages via the Package Manager Console. However, trying to execute that command leads to this issue.

VS Version: 16.3 Preview 3

same with VS 2019 Pro latest, and local .net core package.

Using MyGet packages on multiple computers working on same project is not really possible.
Only workaround is add multiple feeds (for every project or package) to every computer, which is not scalable at all.
Needs to fix is ASAP.

Using MyGet packages on multiple computers working on same project is not really possible.
Only workaround is add multiple feeds (for every project or package) to every computer, which is not scalable at all.
Needs to fix is ASAP.

Why not add the package sources to a Nuget.config and add it to source control?

Thanks, i'll try that. Last time i tried (few years ago) VS nuget manager did not support it.

@JimBobSquarePants that's fine if you know you want to be pulling from MyGet for a long-term project, but sometimes you just want to pull a dev package to test something quick or try out a new feature, setting up a NuGet.config for that single purpose isn't a great workaround.

I think the main thing here is that MyGet still provides an easy copy-paste command on their website in order to pull down the package, but that's broken because of this bug.

@michael-hawker You should be using a Nuget.config file for ALL projects that are source controlled. It's just good practice.

I agree with @michael-hawker.
I'm now working on a repo and wanna test one of the NuGet packages I made local changes to.
It really doesn't make sense to add that file or change it to accommodate for my local path.
What I ended up doning instead is adding that path to the NuGet sources in VS.
It would have been better if there woulda been an opt in option "Allow installation of packages from unknown sources", that eliminated that error and allows for hassle free package installation.

@JimBobSquarePants agreed but it's a PITA for local testing since you end up having to put a physical path in the NuGet.Config. That's fine if the repo is a throw away for testing but not something to check into source control.

@weitzhandler What happens if you have dependencies on other packages that aren't on nuget feeds? There are several issues with local package development that makes things painful for fast iteration:

  • Package versions need to be revved every build to avoid getting the cached version on install
  • The a pseudo local feed of each project needs to be added (unless you build all packages to the same output location).

Hey all,
if you are trying to work with packages that under development, please consider upvoting https://github.com/NuGet/Home/issues/6579.

@davidfowl thanks for your explanation.
My use case is quick testing scenarios. Regarding the version, I go with ..*.1, and since usually the packages I'm working on don't have these increments it works out to be fine.
Adding the source to VS settings is fine with me.

Not only has there been no fix for this issue in almost two years, we haven't even been provided an explanation as to why this happens. Par for the course for the NuGet team, though.

FWIW it seems some of our users are running into this issue when attempting to run a command we provide in our CI/CD (example). An example report of this issue can be seen here.

@Mike-E-angelo

The scenario you linked is our primary motivation as to why is the source parameter is not respected.

We want to steer people in a direction where their restores are repeatable and that can't happen if a package is not in any of the sources specified for that solution/repo/project.

Thank you for your reply and additional information, @nkolev92. From my perspective, it would seem that if a source isn't a part of a solution/repo/project as you point out, then the user should be presented with a subsequent prompt to add it (Y/N/Cancel, etc), rather than failing with an obscure/confusing error that requires one to search Google/GitHub for more information/context. As it stands now it is currently a rather confusing/disruptive user experience.

Adding a prompt is an interesting idea.
Minimally, we could also enhance the message with a suggesting indicating that that the source in questions could/should be added to the nuget.configuration.

fyi @JonDouglas.

Anything for the cause, @nkolev92. 馃榿 That, and anything to keep me from playing the role of tech support. 馃槄

Was this page helpful?
0 / 5 - 0 ratings