NuGet Package Management
NuGet Configuration Management
Configure package sources and NuGet settings.
Configuration Files
Section titled “Configuration Files”NuGet uses hierarchical configuration:
- Machine-level:
%ProgramFiles(x86)%\NuGet\Config - User-level:
%AppData%\NuGet\NuGet.Config - Solution-level:
nuget.configin solution directory
Managing Package Sources
Section titled “Managing Package Sources”Adding a Source
Section titled “Adding a Source”- Open NuGet Manager settings
- Click “Add Source”
- Enter name and URL
- Save configuration
Removing a Source
Section titled “Removing a Source”- Open NuGet Manager settings
- Select the source
- Click “Remove”
- Confirm removal
Enabling/Disabling Sources
Section titled “Enabling/Disabling Sources”Toggle sources on/off without removing them:
- Open NuGet Manager settings
- Use the checkbox next to each source
- Disabled sources won’t be searched
Common Package Sources
Section titled “Common Package Sources”nuget.org (Default)
Section titled “nuget.org (Default)”https://api.nuget.org/v3/index.jsonAzure Artifacts
Section titled “Azure Artifacts”https://pkgs.dev.azure.com/{organization}/_packaging/{feed}/nuget/v3/index.jsonLocal Folders
Section titled “Local Folders”C:\LocalPackagesConfiguration Options
Section titled “Configuration Options”Key settings you can configure:
- Default push source
- Package sources
- Credentials
- Proxy settings
- Cache locations
nuget.config Example
Section titled “nuget.config Example”<?xml version="1.0" encoding="utf-8"?><configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="MyPrivateFeed" value="https://my-feed.com/nuget" /> </packageSources> <packageSourceCredentials> <MyPrivateFeed> <add key="Username" value="user" /> <add key="ClearTextPassword" value="password" /> </MyPrivateFeed> </packageSourceCredentials></configuration>Best Practices
Section titled “Best Practices”- Keep nuget.config in source control
- Don’t commit credentials
- Use credential injection for security
- Document custom feeds for team members
Troubleshooting
Section titled “Troubleshooting”Configuration Not Loading
Section titled “Configuration Not Loading”If configuration isn’t applied:
- Check file location
- Verify XML syntax
- Restart VS Code
- Check for conflicts between config levels