问题
Where does dotnet core look for a nuget executable when running restore commands?
- Is there a separate executable, or are the nuget functions built directly into the cli tools?
- If I already have a nuget executable on my path, can dotnet be configured to use this?
回答1:
NuGet is no longer an executable that runs for a restore operation, it has become an integrated part of the build tooling and the dotnet
CLI.
NuGet operations have been turned into MSBuild tasks which are run during a build. This task would then load some NuGet libraries as needed. There are other tasks that use some NuGet components as well - such as the Pack
target or some tasks used to determine framework compatibility (because NuGet knows which net*
/ netcoreapp*
/ netstandard*
"frameworks" are compatible with another).
The dotnet
CLI also uses some library functions of NuGet to execute commands such as dotnet add package
or the dotnet nuget
commands.
So instead of a single nuget.exe
, you will find some NuGet related DLL files inside the SDK's directory and various components used during the build or command line operations will use functionality of these.
This also means that you can't easily replace them with any nuget.exe
you have on your PATH.
来源:https://stackoverflow.com/questions/50408966/where-is-the-nuget-executable-for-dotnet-core