NuGet Configuration Management
Configure package sources and NuGet settings.
Configuration Files
NuGet uses hierarchical configuration:
- Machine-level:
%ProgramFiles(x86)%\NuGet\Config
- User-level:
%AppData%\NuGet\NuGet.Config
- Solution-level:
nuget.config
in solution directory
Managing Package Sources
Adding a Source
- Open NuGet Manager settings
- Click "Add Source"
- Enter name and URL
- Save configuration
Removing a Source
- Open NuGet Manager settings
- Select the source
- Click "Remove"
- Confirm removal
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
nuget.org (Default)
https://api.nuget.org/v3/index.json
Azure Artifacts
https://pkgs.dev.azure.com/{organization}/_packaging/{feed}/nuget/v3/index.json
Local Folders
C:\LocalPackages
Configuration Options
Key settings you can configure:
- Default push source
- Package sources
- Credentials
- Proxy settings
- Cache locations
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
- Keep nuget.config in source control
- Don't commit credentials
- Use credential injection for security
- Document custom feeds for team members
Troubleshooting
Configuration Not Loading
If configuration isn't applied:
- Check file location
- Verify XML syntax
- Restart VS Code
- Check for conflicts between config levels