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
[MacOS, Linux] NuGet writes the NuGet.Config in ~/.config folder, but dotnet restore reads from ~/.nuget #4413
Comments
@rrelyea this is a known issue. It's a dupe of #4095 we can't change mono to /.nuget, it will break mono restore for existing user. My suggestion is not use mono and dotnet at the same time or use -configfile as a workaround. |
So on Windows dotnet.exe and NuGet.exe both use AppData for their NuGet.Config files but on non-Windows platform they use different locations? |
@zhili1208 Thanks for the info. @mrward As far as I understand it is Mono that sets up the AppData variable with the |
For the time being, this inelegant workaround seems to do the trick:
|
Have the same problem in Jetbrains Rider (I suppose it's because they use both Mono and .net core). It was weird as the UI showed packages from private repositories but then did not install them. The symlink solution did not help as it blew up Rider (he was saying something about relative paths), so for now I fixed it with a Nuget.config in project's folder |
This is a footgun in userland i.e with the use case of needing to run |
On a Mac it looks like Visual Studio Mac prefers to read from Additionally, invoking the CLI I just need to figure out what to tell my devs to set. The Symbolic Link solution above is a nice one and I will probably go with that. I just want to be able to be able to note if it's changing in the future. |
Maybe it will help someone like me: when building my apps in Microsoft's docker container with SDK, i found out that
It would be much easier to just specify an environment variable for all CLI tools. You know, like with all other linux-friendly tooling? |
@aventurella this is not just a Mono thing. .NET Core also resolves It's just that NuGet for .NET Core has this old hard-coded logic in it to look for NuGet.config somewhere else. It used to have this same bad behavior on Windows, and eventually fixed it, but only on Windows. This is all documented in #5555 , which has been ignored for over 2 years now. And yes, Visual Studio for Mac 2019 has the same (better) behavior of looking in |
`dotnet nuget` uses this location, `mono`/`nuget` use the other location: NuGet/Home#4413 See: NuGet/Home#10185
`dotnet nuget` uses this location, `mono`/`nuget` use the other location: NuGet/Home#4413 See: NuGet/Home#10185
We end up with updating docs in NuGet/docs.microsoft.com-nuget#2822. |
Documenting a poor workaround is not a "fix" |
When using NuGet to add a private feed,
NuGet Sources Add
writes in~/.config/NuGet/NuGet.Config
file. But when usingdotnet restore
the~/.nuget/NuGet/NuGet.Config
file is used to read thepackageSources
andpackageSourceCredentials
.This issue forces users to manually copy and paste all necessary information instead of having that generated automatically by the NuGet CLI.
DotNetCore repo issue: dotnet/core#453
The text was updated successfully, but these errors were encountered: