问题
I'm doing a simple dotnet restore
on my mac. I'm using the (for now) latest dotnet CLI version 2.2.
Since you can have both a NuGet.Config file in your project folder and a machine-wide config, say:
~/projects/helloworld/.NuGet/NuGet.Config
~/.nuget/NuGet/NuGet.Config
Is there any way to ask dotnet restore
like "hey, if if were to run you, what combination of NuGet sources would you actually use?"
As you might have guessed my problem is that i'm not really sure that all my defined sources are used.
(actually my problem is that running dotnet restore --interactive
does not prompt me, which I would expect, so I assume NuGet is not even trying to fetch packages from my defined source)
Hope you guys can help me out.
回答1:
Use dotnet restore -v:n
to make dotnet restore
display information with "verbosity" level of "normal". This will show you a lot of information. Towards the end, you will get information like this:
NuGet Config files used:
/home/omajid/.nuget/NuGet/NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
That shows which nuget config files and nuget feeds were used.
(Unfortunately, there doesn't seem to be a option to say "just show me, but don't do a restore".)
回答2:
My experience is that NuGet uses all the sources to try and find the correct package you are looking for. We have a private nuget feed where we host our own packages and those will automatically be found when added to the project.
When we add external packages it automatically fetches from the "public" nuget store.
You also have the option to add a Source to your install command (which in most IDEs is a dropdown): https://stackoverflow.com/a/6953879/1387545
来源:https://stackoverflow.com/questions/55297944/what-nuget-sources-are-used-for-restore