Skip to main content

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

1

Project File Detection

When you open or update a project file (.csproj, .fsproj, .vbproj), the extension reads:
  • Target framework (<TargetFramework>)
  • Package references (<PackageReference>)
2

Package Validation

For each package, the extension:
  1. Checks the local compatibility rules database
  2. Queries NuGet.org API for package metadata (if enabled)
  3. Verifies framework compatibility
  4. Checks version existence and compatibility
3

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
4

Enhanced Suggestions

For each issue, the extension provides:
  • Suggested compatible versions
  • Alternative package recommendations
  • Transitive dependency warnings
  • Framework upgrade suggestions
5

Visual Feedback

Issues are displayed as:
  • Red squiggly lines for errors (incompatible)
  • Yellow squiggly lines for warnings (version mismatch, deprecated)
  • Detailed tooltips on hover
  • Entries in the Problems panel (Ctrl+Shift+M)

Inline Diagnostics

Visual Indicators

When you open a project file with compatibility issues:
MyProject.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>
  
  <ItemGroup>
    <!-- Red squiggly line under Include attribute -->
    <PackageReference Include="EntityFramework" Version="6.4.4" />
    
    <!-- Yellow squiggly line -->
    <PackageReference Include="Newtonsoft.Json" Version="99.0.0" />
  </ItemGroup>
</Project>

Tooltip Information

Hover over the underlined package to see detailed information:
❌ EntityFramework: Package is not compatible with net8.0

💡 Suggested version: 6.4.4 (if compatible version exists)

🔄 Alternative: Microsoft.EntityFrameworkCore (8.0.0)
   Recommendation: Modern Entity Framework Core for .NET Core/.NET 5+

📝 This package requires: net40, net45, net46, net461, net462, net47, net471, net472, net48

Problems Panel

All issues also appear in the Problems panel:
  1. Open Problems panel: Ctrl+Shift+M
  2. Filter by “DotNET Build Buddy”
  3. 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:
The extension:
  1. Fetches all available versions from NuGet.org
  2. Filters versions compatible with your target framework
  3. Suggests the latest compatible version
  4. Falls back to the latest version if compatibility can’t be determined
Example:
<!-- You have -->
<PackageReference Include="Serilog" Version="2.0.0" />

<!-- Suggestion: Upgrade to 3.1.1 (latest compatible) -->
To apply a suggested version:
  1. Hover over the underlined package
  2. Note the suggested version in the tooltip
  3. Manually update the Version attribute
<!-- Before -->
<PackageReference Include="Serilog" Version="2.0.0" />

<!-- After -->
<PackageReference Include="Serilog" Version="3.1.1" />
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:
<!-- Legacy (incompatible with .NET Core/.NET 5+) -->
<PackageReference Include="EntityFramework" Version="6.4.4" />

<!-- Suggested Alternative -->
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
Why: EntityFramework (classic) only supports .NET Framework. Modern .NET requires Entity Framework Core.
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

1

Analysis

The extension checks each package against newer frameworks in the upgrade path:
  • netcoreapp3.1net5.0, net6.0, net7.0, net8.0
  • net6.0net7.0, net8.0
  • net7.0net8.0
2

Compatibility Check

For each newer framework, the extension verifies that all packages are compatible.
3

Recommendation

If 80%+ of packages support a newer framework, you’ll see a suggestion:
💡 MyProject.csproj: Consider upgrading from netcoreapp3.1 to net8.0.
   All packages support net8.0
4

Learn More

Click “Learn More” to open Microsoft’s migration documentation.

Applying Framework Upgrades

To upgrade your target framework:
1

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
2

Update Project File

Edit your .csproj file:
<PropertyGroup>
  <!-- Before -->
  <TargetFramework>netcoreapp3.1</TargetFramework>
  
  <!-- After -->
  <TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
3

Test Your Application

After upgrading:
  1. Build your project: dotnet build
  2. Run tests: dotnet test
  3. Test application functionality
  4. Review any new warnings or errors
4

Update Packages (Optional)

Consider updating package versions to take advantage of new framework features:
dotnet list package --outdated
dotnet add package <PackageName>
Always test thoroughly after framework upgrades. Breaking changes may require code modifications.

Transitive Dependency Checking

The extension checks not only direct dependencies but also their dependencies (transitive dependencies).

What Are Transitive Dependencies?

Your Project
├── PackageA (direct dependency)
│   ├── PackageB (transitive dependency)
│   └── PackageC (transitive dependency)
│       └── PackageD (transitive dependency)

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

<PackageReference Include="LibraryX" Version="2.0.0" />
Tooltip shows:
⚠️ LibraryX: Compatible with net8.0

⚠️ Transitive dependency issues:
  • LibraryY 1.0.0: Not compatible with net8.0
  • LibraryZ: Version mismatch
Transitive dependency checking requires nugetApiEnabled to be true (default) as it queries NuGet.org for package metadata.

Configuration

Enable/Disable Compatibility Checking

settings.json
{
  // Master switch for all NuGet compatibility features
  "dotnetBuildBuddy.nugetCheckEnabled": true,
  
  // Enable real-time NuGet.org API lookups
  "dotnetBuildBuddy.nugetApiEnabled": true
}
  • 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
{
  // Enable caching of compatibility check results
  "dotnetBuildBuddy.nugetCacheEnabled": true,
  
  // Cache expiry time in seconds (default: 3600 = 1 hour)
  "dotnetBuildBuddy.nugetCacheExpiry": 3600
}
Cache Behavior:
  • Results are cached per package, version, and target framework
  • Cache expires after nugetCacheExpiry seconds
  • 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
{
  // Timeout in milliseconds (default: 5000 = 5 seconds)
  "dotnetBuildBuddy.nugetApiTimeout": 5000
}
Increase timeout if you have a slow internet connection. Decrease for faster failure on network issues.

Ignoring Packages

Exclude specific packages from compatibility checks:
settings.json
{
  "dotnetBuildBuddy.nugetIgnoredPackages": [
    "MyCustomPackage",          // Exact match
    "Internal.*",               // Wildcard pattern
    "Company.*.Beta"            // Multiple wildcards
  ]
}
Use Cases:
  • 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:
  • Microsoft.AspNetCore.App: Requires netcoreapp2.1 or higher
  • Microsoft.AspNetCore.Mvc: Framework-version alignment required
  • Microsoft.AspNetCore.***: Modern .NET only
  • Microsoft.EntityFrameworkCore: Requires netstandard2.0 or higher
  • EntityFramework: .NET Framework only (max net48)
  • Microsoft.Extensions.Hosting: Requires netcoreapp2.1 or higher
  • Microsoft.Extensions.DependencyInjection: Requires netstandard1.0 or higher
  • Microsoft.Extensions.Logging: Requires netstandard1.1 or higher
  • Microsoft.AspNetCore.Components.Web: Requires netcoreapp3.1 or higher
  • Microsoft.AspNetCore.Components.WebAssembly: Requires netstandard2.1 or higher
  • xunit: Requires netstandard1.1 or higher
  • NUnit: Requires netstandard1.6 or higher
  • Moq: Requires netstandard2.0 or higher
These rules are maintained in the extension source code at src/nugetCompatibilityChecker.ts:561.

Troubleshooting

No Diagnostics Appearing

1

Check Settings

Verify compatibility checking is enabled:
{
  "dotnetBuildBuddy.nugetCheckEnabled": true
}
2

Open Project File

Diagnostics only appear when the project file is open in the editor. Open your .csproj file.
3

Check Problems Panel

Open Problems panel (Ctrl+Shift+M) and look for issues under “DotNET Build Buddy”.
4

Reload Window

Sometimes diagnostics need a refresh. Reload VS Code (Ctrl+R).

False Positives

If a package is marked incompatible but works fine:
1

Verify Actual Compatibility

Test build and runtime behavior:
dotnet build
dotnet run
2

Check NuGet.org

Visit the package page on NuGet.org to verify supported frameworks.
3

Add to Ignore List

If it’s a false positive:
{
  "dotnetBuildBuddy.nugetIgnoredPackages": [
    "ProblematicPackage"
  ]
}
4

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
{
  // Increase timeout
  "dotnetBuildBuddy.nugetApiTimeout": 10000,
  
  // Or disable API and use local rules only
  "dotnetBuildBuddy.nugetApiEnabled": false
}

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.

Build docs developers (and LLMs) love