What is NuGet?
BeginnerConcept.NET builds (dotnet CLI)
Answer
Short answer
NuGet is the package manager for .NET — the equivalent of npm or Maven. Packages (.nupkg files) are downloaded from nuget.org or a private feed (Azure Artifacts, Nexus, Artifactory) during dotnet restore, based on the PackageReference entries in each .csproj.
Commands
dotnet add package Npgsql --version 8.0.3
dotnet remove package OldLib
dotnet list package --outdated
dotnet list package --vulnerable --include-transitive
dotnet nuget locals all --clear # clear the local cache
Private feed with nuget.config
<configuration>
<packageSources>
<clear />
<add key="company" value="https://pkgs.dev.azure.com/org/_packaging/shop/nuget/v3/index.json" />
</packageSources>
</configuration>
Credentials come from CI (e.g. NuGetAuthenticate@1 task in Azure DevOps or a PAT secret).
Cache
Packages are cached in ~/.nuget/packages — cache this folder in CI.
What to say in the interview
"NuGet is .NET's package manager. dotnet restore pulls PackageReferences from nuget.org or our Azure Artifacts feed defined in nuget.config, and we cache ~/.nuget/packages in CI and check dotnet list package --vulnerable for CVEs."
More on .NET builds (dotnet CLI)
How do you build and run a .NET application?BeginnerWhat is the difference between .NET Framework and modern .NET?BeginnerWhat are .csproj and .sln files?BeginnerExplain dotnet restore, build, test and publish.BeginnerWhat is Kestrel?BeginnerHow does configuration work in ASP.NET Core (appsettings.json and environment variables)?Intermediate