-
Notifications
You must be signed in to change notification settings - Fork 252
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
VS solution restore does not read project level nuget config file #6746
Comments
This was done by design in VS, and we should probably consider changing the respective docs to represent the current behavior. https://developercommunity.visualstudio.com/content/problem/217493/visual-studio-nuget-package-manager-ignores-nugetc-1.html |
Why is this by design? |
@anangaur The per project feature is the one that was added later. That's the one that changed the experience. We'd need to talk about hierarchical settings in VS so we can actually display what settings you have configured in a meaningful way. Now that we are integrated in MsBuild, and you can configure almost everything project related through it, we need to think hard whether we want to add more dependencies for a project build in an auxiliary file. |
before everything else, who's asking for this? |
I was asking for it for two good reasons:
BTW, this caused an "unable to build" state with the Blazor project (at his early stage, when bits were only available on nightly builds and the NuGet source was specified in a NuGet config file at project level). But the VS Code and the CLI build worked as expected. So if this is a feature of VS IDE, it's wrong and should be changed. |
We'll discuss and likely amend the documentation at least in the short term.
It doesn't have to be next to a solution folder. It just needs to be in the recursive path of all projects.
This should work in both VS Code and VS. Just to get more information about your setup. Why are you using project level config files? |
@nkolev92 I run into this problem using early stage of Blazor bits, where the NuGet.Config file was inside the project. I wrote a post to help many others to solve the issue, frequently asked in the Blazor Gitter group. Actually they have updated their README to include instructions on how to write a proper NuGet.Config file and were to put it, so the issue is no more... an issue! :-) |
I've got a different situation which would benefit greatly from per-project NuGet.config files. My employer has a strict policy around third party library approvals. We've got 2 separate MyGet.org feeds that can be used: one for packages that have been strictly reviewed for production use, and one for packages that have been loosely reviewed for internal use only. We've just encountered a situation where a team wants to reference the internal-only feed for an integration test project in a solution. This is logically ok, because the integration tests aren't released with the production code. However, this does make managing the project hard. Our current options are:
Having per-project NuGet.config files would allow the just the internal-only projects to have access to the internal-only feed. |
What are your project types? Packages.config vs PackageReference? There are ways you can achieve this without hurting your workflow. Regarding the dev scenario. If you're using packages.config, doing a commandline restore would be your best option. In the PackageReference scenario, you can set the sources via a property in the csproj, RestoreSources, but take into consideration the following issue. Happy to provide more ideas if you have some other scenarios. |
@nkolev92 It's an old code base that's targeting .NET 4.6.2, and is only just moving onto VS2017 build servers. We're stuck with packages.config files for the time being. As you say, we do have the option of using a command line restore as part of the build script. It could look for any directories that contain a NuGet.config file, then any projects under those directories, and do a This gets around the build issues, but doesn't work nicely for maintaining the project inside VS. There's no way to grab new or updated packages from the internal-only feed, because VS doesn't know that the feed exists. The only options are to use the package manager console, or to have a separate solution and NuGet.config just for maintaining the packages. |
I would like to add another scenario. I have a template ( Documentation still mentions 'project-specific nuget.config' here https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file. |
Details about Problem
NuGet product used: VS 15.7 P3
NuGet version (x.x.x.xxx): 4.7.0.5039
Detailed repro steps so we can see the same problem
Take this projectA.zip
Open solution in VS and try solution restore.
Expected
The project should restore correctly.
Actual
The project restore fails because reference to
NuGet.Build.Tasks
cannot be found as the exact version's source is in the project specific nuget config file.Its important to note that running
dotnet restore projectA.Sln
works fine.Related
Duplicate report
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/597899
The text was updated successfully, but these errors were encountered: