Overview
The NuGet compatibility checker:- Verifies package compatibility with target frameworks
- Fetches real-time data from NuGet.org API
- Provides version suggestions and alternatives
- Checks transitive dependencies
- Suggests framework upgrades when beneficial
- Uses intelligent caching for performance
Core Configuration
Enable Compatibility Checking
Master switch for NuGet package compatibility checking.When disabled, no compatibility checks are performed. All other NuGet-related settings are ignored.
Disabling this setting turns off all NuGet compatibility features, including inline diagnostics and suggestions.
Enable API Lookups
Enable real-time package information from NuGet.org API.When enabled, the extension queries the NuGet API for accurate package metadata. When disabled, only built-in compatibility rules are used.
API vs Local Rules
| Feature | API Enabled | API Disabled |
|---|---|---|
| Package version info | Real-time from NuGet.org | Not available |
| Framework compatibility | Accurate, up-to-date | Built-in rules only |
| New packages | Full support | Limited support |
| Network required | Yes | No |
| Performance | Slower (cached) | Faster |
Caching Configuration
Enable Caching
Cache compatibility check results to improve performance.When enabled, results are stored in memory and reused until they expire.
Cache Expiry
How long (in seconds) cached results remain valid.Default is 3600 seconds (1 hour). Increase for stable projects, decrease for active development.
Cache Management
The cache:- Stores results in memory (not persisted)
- Keys by package name, version, and target framework
- Automatically expires based on
nugetCacheExpiry - Clears when VS Code restarts
Ignored Packages
Configuration
List of package names or patterns to exclude from compatibility checks.Supports exact names and wildcard patterns using
*.Pattern Matching
Pattern matching rules:- Exact match:
"MyPackage"matches onlyMyPackage - Wildcard:
"Company.*"matchesCompany.Core,Company.Data, etc. - Case insensitive:
"mypackage"matchesMyPackage
Common Use Cases
Internal/Private Packages
Legacy Packages
Test Packages
Network Configuration
API Timeout
Maximum time (in milliseconds) to wait for NuGet API responses.Default is 5000ms (5 seconds). Increase for slow connections, decrease for faster failure detection.
Timeout Behavior
When a timeout occurs:- API request is cancelled
- Falls back to local compatibility rules
- Result is not cached
- No error is shown to user
Network Recommendations
| Connection Speed | Recommended Timeout |
|---|---|
| Fast (>10 Mbps) | 3000ms |
| Normal | 5000ms (default) |
| Slow (<1 Mbps) | 10000ms |
| Proxy/VPN | 15000ms |
Compatibility Rules
The extension includes built-in rules for common packages:Framework Categories
- ASP.NET Core:
Microsoft.AspNetCore.* - Entity Framework:
Microsoft.EntityFrameworkCore.* - Extensions:
Microsoft.Extensions.* - Blazor:
Microsoft.AspNetCore.Components.* - SignalR:
Microsoft.AspNetCore.SignalR.* - gRPC:
Grpc.*
Example Rules
Configuration Profiles
Production Environment
Optimized for stability and performance:Development Environment
Balanced for accuracy and responsiveness:Offline Environment
For environments without internet access:Performance-Focused
Minimize API calls and maximize caching:Minimal Checking
Quick checks with local rules only:Understanding Compatibility Issues
Issue Types
The checker reports three types of issues:1. Incompatible
- Upgrading target framework
- Using an alternative package
- Finding a compatible version
2. Version Mismatch
- Update to suggested version
- Check version constraints
- Review package documentation
3. Deprecated
- Migrating to alternative package
- Upgrading to newer version
- Evaluating project requirements
Enhanced Issue Information
When API is enabled, issues include:- Suggested Version: Recommended compatible version
- Alternative Package: Modern replacement packages
- Transitive Issues: Problems with dependencies
Advanced Features
Framework Upgrade Suggestions
The extension can suggest framework upgrades when all packages support newer versions:- Analyzes all project packages
- Checks compatibility with newer frameworks
- Suggests upgrade only when beneficial
- Shows which packages support the upgrade
Transitive Dependency Checking
When enabled, the checker verifies indirect dependencies:- Detects hidden compatibility issues
- Identifies problematic sub-dependencies
- Provides complete compatibility picture
Alternative Package Suggestions
For incompatible packages, the extension suggests modern alternatives:| Old Package | Alternative | Reason |
|---|---|---|
| EntityFramework | Microsoft.EntityFrameworkCore | Modern EF for .NET Core/.NET 5+ |
| Microsoft.AspNet.Mvc | Microsoft.AspNetCore.Mvc | Modern ASP.NET Core MVC |
| Newtonsoft.Json | System.Text.Json | Built-in JSON in .NET Core/.NET 5+ |
Troubleshooting
API Requests Timing Out
Missing Compatibility Warnings
Verify settings are enabled
Verify settings are enabled
Check that both
nugetCheckEnabled and nugetApiEnabled are true.Check ignored packages
Check ignored packages
Ensure the package isn’t in
nugetIgnoredPackages.Clear cache
Clear cache
Restart VS Code to clear the compatibility cache.
Check package rules
Check package rules
Some packages may not have built-in rules and require API lookups.
Performance Issues
- High Memory Usage
- Slow Checks
- Too Many API Calls
Reduce cache expiry:
Internal Package Warnings
Ignore your internal packages:Best Practices
Enable API Lookups
Use
nugetApiEnabled: true for accurate, up-to-date compatibility information.Use Caching
Keep
nugetCacheEnabled: true to reduce API calls and improve performance.Configure Timeout
Adjust
nugetApiTimeout based on your network speed.Ignore Internal Packages
Add your company’s packages to
nugetIgnoredPackages to reduce noise.Next Steps
Settings Overview
View all configuration options
Watch Patterns
Configure file monitoring patterns