Skip to main content
DotNET Build Buddy provides three VS Code commands that can be executed from the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) or programmatically.

Available Commands

Generate Solution File

command
string
required
dotnetBuildBuddy.generateSolution
Generates a Visual Studio solution (.sln) file that includes all .NET project files found in the workspace.

Usage

{
  "command": "dotnetBuildBuddy.generateSolution",
  "title": "Generate Solution File",
  "category": "DotNET Build Buddy"
}
Command Palette:
DotNET Build Buddy: Generate Solution File
What it does:
  • Searches for all .csproj, .fsproj, and .vbproj files in the workspace
  • Creates a Solution.sln file in the workspace root
  • Configures Debug and Release build configurations
  • Associates each project with the appropriate project type GUID
Example Implementation:
import * as vscode from 'vscode';

// Trigger the command programmatically
vscode.commands.executeCommand('dotnetBuildBuddy.generateSolution');
output
void
The command does not return a value. Success or error messages are displayed via VS Code notifications.

Update Project Files

command
string
required
dotnetBuildBuddy.updateProjects
Updates or creates .NET project files based on source files found in the workspace, and checks for NuGet package compatibility issues.

Usage

{
  "command": "dotnetBuildBuddy.updateProjects",
  "title": "Update Project Files",
  "category": "DotNET Build Buddy"
}
Command Palette:
DotNET Build Buddy: Update Project Files
What it does:
  • Scans for .cs, .fs, and .vb source files
  • Groups files by directory and project type
  • Updates or creates corresponding project files (.csproj, .fsproj, .vbproj)
  • Preserves existing project settings (target framework, package references, etc.)
  • Performs NuGet compatibility checks for all package references
  • Reports compatibility issues and suggests fixes
  • Suggests framework upgrades when beneficial
Example Implementation:
import * as vscode from 'vscode';

// Trigger the command programmatically
vscode.commands.executeCommand('dotnetBuildBuddy.updateProjects');
output
void
The command does not return a value. Success or error messages are displayed via VS Code notifications.
Related Configuration:
  • dotnetBuildBuddy.autoUpdate - Enable/disable automatic updates
  • dotnetBuildBuddy.nugetCheckEnabled - Enable/disable NuGet compatibility checking
  • dotnetBuildBuddy.nugetApiEnabled - Enable/disable real-time NuGet API lookups

Refresh All .NET Files

command
string
required
dotnetBuildBuddy.refreshAll
Performs a complete refresh of all .NET project files and the solution file. This is a comprehensive command that combines updating projects and regenerating the solution.

Usage

{
  "command": "dotnetBuildBuddy.refreshAll",
  "title": "Refresh All .NET Files",
  "category": "DotNET Build Buddy"
}
Command Palette:
DotNET Build Buddy: Refresh All .NET Files
What it does:
  1. Updates all project files (same as updateProjects)
  2. Generates/updates the solution file (same as generateSolution)
  3. Performs comprehensive NuGet compatibility checks
  4. Updates inline diagnostics for compatibility issues
Example Implementation:
import * as vscode from 'vscode';

// Trigger the command programmatically
vscode.commands.executeCommand('dotnetBuildBuddy.refreshAll');
output
void
The command does not return a value. Success or error messages are displayed via VS Code notifications.
Use this command when you’ve made significant changes to your project structure or want to ensure everything is in sync.

Command Registration

All commands are registered in the extension’s activate function in /workspace/source/src/extension.ts:30.
export function activate(context: vscode.ExtensionContext) {
    projectManager = new DotNetProjectManager();
    fileWatcher = new FileWatcher(projectManager);

    const generateSolutionCommand = vscode.commands.registerCommand(
        'dotnetBuildBuddy.generateSolution',
        () => projectManager.generateSolutionFile()
    );

    const updateProjectsCommand = vscode.commands.registerCommand(
        'dotnetBuildBuddy.updateProjects',
        () => projectManager.updateAllProjectFiles()
    );

    const refreshAllCommand = vscode.commands.registerCommand(
        'dotnetBuildBuddy.refreshAll',
        () => projectManager.refreshAllFiles()
    );

    context.subscriptions.push(
        generateSolutionCommand,
        updateProjectsCommand,
        refreshAllCommand,
        fileWatcher
    );
}

Error Handling

All commands include error handling and will display error messages via VS Code’s notification system if operations fail.
Commands require an active workspace folder to function. They will return early with an error message if no workspace is found.

Build docs developers (and LLMs) love