Overview
DotNET Build Buddy includes powerful NuGet package compatibility features that help you avoid compatibility issues before they cause runtime problems.Features
Real-time Compatibility Checks
Automatically verifies package compatibility with your target framework using the NuGet.org API.
Inline Diagnostics
See errors and warnings directly in your project files with detailed tooltips.
Smart Version Suggestions
Get recommendations for compatible package versions when you’re using an incompatible one.
Alternative Packages
Discover modern alternatives for deprecated or incompatible packages.
Transitive Dependencies
Check compatibility of dependencies of dependencies (indirect dependencies).
Framework Upgrades
Get suggestions to upgrade your target framework when all packages support newer versions.
How It Works
Compatibility Checking Process
Project File Detection
When you open or update a project file (
.csproj, .fsproj, .vbproj), the extension reads:- Target framework (
<TargetFramework>) - Package references (
<PackageReference>)
Package Validation
For each package, the extension:
- Checks the local compatibility rules database
- Queries NuGet.org API for package metadata (if enabled)
- Verifies framework compatibility
- Checks version existence and compatibility
Issue Detection
The extension identifies three types of issues:
- Incompatible: Package doesn’t support the target framework
- Version Mismatch: Version doesn’t exist or is incompatible
- Deprecated: Package or version is deprecated
Enhanced Suggestions
For each issue, the extension provides:
- Suggested compatible versions
- Alternative package recommendations
- Transitive dependency warnings
- Framework upgrade suggestions
Inline Diagnostics
Visual Indicators
When you open a project file with compatibility issues:MyProject.csproj
Tooltip Information
Hover over the underlined package to see detailed information:- Incompatible Package
- Version Mismatch
- Deprecated Package
- Transitive Issues
Problems Panel
All issues also appear in the Problems panel:- Open Problems panel:
Ctrl+Shift+M - Filter by “DotNET Build Buddy”
- Click on an issue to navigate to the source
Package Suggestions
Version Suggestions
When you use an incompatible or non-existent version, the extension suggests compatible versions:How Versions Are Suggested
How Versions Are Suggested
The extension:
- Fetches all available versions from NuGet.org
- Filters versions compatible with your target framework
- Suggests the latest compatible version
- Falls back to the latest version if compatibility can’t be determined
Applying Suggestions
Applying Suggestions
To apply a suggested version:
- Hover over the underlined package
- Note the suggested version in the tooltip
- Manually update the
Versionattribute
Auto-fix quick actions are not currently available, but may be added in future versions.
Alternative Packages
For incompatible or deprecated packages, the extension suggests modern alternatives:- EntityFramework → EF Core
- ASP.NET → ASP.NET Core
- Newtonsoft.Json → System.Text.Json
Alternative suggestions are based on a curated database of common migration paths. Not all packages have alternatives suggested.
Framework Upgrade Suggestions
When all your packages support a newer framework, you’ll receive upgrade suggestions.How It Works
Analysis
The extension checks each package against newer frameworks in the upgrade path:
netcoreapp3.1→net5.0,net6.0,net7.0,net8.0net6.0→net7.0,net8.0net7.0→net8.0
Compatibility Check
For each newer framework, the extension verifies that all packages are compatible.
Applying Framework Upgrades
To upgrade your target framework:Review Suggestion
Read the framework upgrade suggestion carefully and consider:
- Whether your application is ready for the upgrade
- Breaking changes in the new framework
- Team and deployment readiness
Test Your Application
After upgrading:
- Build your project:
dotnet build - Run tests:
dotnet test - Test application functionality
- Review any new warnings or errors
Transitive Dependency Checking
The extension checks not only direct dependencies but also their dependencies (transitive dependencies).What Are Transitive Dependencies?
How It Helps
Transitive dependency checking warns you when:- A direct dependency relies on incompatible packages
- Indirect dependencies have compatibility issues
- Version conflicts exist in the dependency tree
Example
Transitive dependency checking requires
nugetApiEnabled to be true (default) as it queries NuGet.org for package metadata.Configuration
Enable/Disable Compatibility Checking
settings.json
- Both Enabled (Default)
- nugetApiEnabled: false
- nugetCheckEnabled: false
- Full compatibility checking
- API lookups for package metadata
- Most accurate results
- Requires internet connection
Caching
Reduce API calls and improve performance with caching:settings.json
- Results are cached per package, version, and target framework
- Cache expires after
nugetCacheExpiryseconds - Cache is cleared when VS Code restarts
- Disable cache to always get fresh results (slower)
API Timeout
Control how long to wait for NuGet API responses:settings.json
Ignoring Packages
Exclude specific packages from compatibility checks:settings.json
- Internal packages not on NuGet.org
- Custom package sources
- Packages with incorrect metadata
- False positives you want to suppress
Known Compatibility Rules
The extension includes built-in rules for popular packages:ASP.NET Core
ASP.NET Core
- Microsoft.AspNetCore.App: Requires
netcoreapp2.1or higher - Microsoft.AspNetCore.Mvc: Framework-version alignment required
- Microsoft.AspNetCore.***: Modern .NET only
Entity Framework
Entity Framework
- Microsoft.EntityFrameworkCore: Requires
netstandard2.0or higher - EntityFramework: .NET Framework only (max
net48)
Extensions
Extensions
- Microsoft.Extensions.Hosting: Requires
netcoreapp2.1or higher - Microsoft.Extensions.DependencyInjection: Requires
netstandard1.0or higher - Microsoft.Extensions.Logging: Requires
netstandard1.1or higher
Blazor
Blazor
- Microsoft.AspNetCore.Components.Web: Requires
netcoreapp3.1or higher - Microsoft.AspNetCore.Components.WebAssembly: Requires
netstandard2.1or higher
Testing
Testing
- xunit: Requires
netstandard1.1or higher - NUnit: Requires
netstandard1.6or higher - Moq: Requires
netstandard2.0or higher
These rules are maintained in the extension source code at
src/nugetCompatibilityChecker.ts:561.Troubleshooting
No Diagnostics Appearing
Open Project File
Diagnostics only appear when the project file is open in the editor. Open your
.csproj file.Check Problems Panel
Open Problems panel (
Ctrl+Shift+M) and look for issues under “DotNET Build Buddy”.False Positives
If a package is marked incompatible but works fine:Report Issue
If you believe the rule is incorrect, report an issue with details.
API Timeouts
If you see timeout errors in the Output panel:settings.json
Best Practices
Review Suggestions
Don’t blindly apply all suggestions. Review alternatives and consider your application’s specific needs.
Test After Changes
Always test your application after changing packages or frameworks. Compatibility checking can’t catch all issues.
Keep Cache Enabled
Leave caching enabled unless you’re troubleshooting. It significantly improves performance.
Monitor Output Panel
Watch the Output panel for detailed compatibility reports and API errors.
Next Steps
Configuration Reference
Explore all NuGet-related configuration options.
Troubleshooting
Find solutions to common NuGet compatibility issues.