Skip to main content
DotNET Build Buddy automatically manages your .NET project files, creating and updating them based on your source code structure. This feature eliminates the need to manually maintain project files and ensures they stay synchronized with your codebase.

How It Works

The project manager scans your workspace for .NET source files and automatically:
  1. Detects source files - Finds all .cs, .fs, and .vb files in your workspace
  2. Groups by directory - Intelligently organizes files into projects based on directory structure
  3. Creates project files - Generates appropriate project files (.csproj, .fsproj, .vbproj) for each group
  4. Maintains solutions - Updates solution files (.sln) to include all discovered projects
  5. Preserves configurations - Keeps existing project settings, package references, and custom properties
The project manager uses intelligent grouping: files in the same directory with the same language type are grouped into a single project, while files in different directories get separate projects.

Project File Generation

Multi-Language Support

DotNET Build Buddy supports all major .NET languages:
  • C# - Creates .csproj files with Microsoft.NET.Sdk
  • F# - Creates .fsproj files with language-specific configurations
  • VB.NET - Creates .vbproj files with RootNamespace settings

Framework Detection

The extension automatically detects the target framework for your projects:
// From dotnetProjectManager.ts:404
private async detectTargetFramework(): Promise<string | null> {
    // Try to detect from existing projects in workspace
    const existingProjects = await this.findProjectFiles();
    
    for (const projectFile of existingProjects) {
        const info = await this.readProjectFile(projectFile);
        if (info.targetFramework) {
            return info.targetFramework;
        }
    }
    
    // Default to .NET 8.0
    return 'net8.0';
}
If no existing project is found, it defaults to net8.0 (the latest LTS version).

Configuration Preservation

When updating existing project files, Build Buddy preserves:
  • Target Framework - Your specified framework version (e.g., net8.0, net6.0)
  • Nullable Reference Types - <Nullable>enable</Nullable> settings
  • Custom Properties - Any additional MSBuild properties you’ve defined
  • Package References - All NuGet package dependencies
  • SDK Attributes - Custom SDK specifications
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
  </ItemGroup>

</Project>

Solution File Management

The extension generates Visual Studio solution files (.sln) that include all discovered projects in your workspace.

Solution Structure

Generated solution files include:
  • Project entries - All .csproj, .fsproj, and .vbproj files in the workspace
  • Build configurations - Debug and Release configurations for all platforms
  • Project GUIDs - Automatically generated unique identifiers
  • Type-specific GUIDs - Correct project type identifiers for each language
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProject", "src/MyProject.csproj", "{GUID}"
EndProject

Project Type GUIDs

The correct Visual Studio project type GUID is used for each language:
LanguageProject Type GUID
C#9A19103F-16F7-4668-BE54-9A1E7A4F7556
F#6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705
VB.NETF184B08F-C81C-45F6-A57F-5ABD9991F28F

Directory-Based Grouping

The project manager uses intelligent directory-based grouping to organize source files:
// From dotnetProjectManager.ts:210
private groupSourceFilesByDirectory(sourceFiles: string[]): Record<string, string[]> {
    const groups: Record<string, string[]> = {};

    for (const file of sourceFiles) {
        const ext = path.extname(file).toLowerCase();
        const projectType = this.getProjectTypeFromExtension(ext);
        const fileDir = path.dirname(file);
        
        // Group by project type and directory
        const key = `${projectType}|${fileDir}`;
        
        if (!groups[key]) {
            groups[key] = [];
        }
        groups[key].push(file);
    }

    return groups;
}

Grouping Rules

  1. Files with the same language type in the same directory → Single project
  2. Files in different directories → Separate projects
  3. Different language types → Separate projects (even in same directory)
This grouping strategy allows you to organize your codebase naturally using folders, and Build Buddy will automatically create the appropriate project structure.

File Search Patterns

The project manager uses glob patterns to discover files while excluding build artifacts: Include Patterns:
  • **/*.cs - All C# files
  • **/*.fs - All F# files
  • **/*.vb - All VB.NET files
  • **/*.csproj, **/*.fsproj, **/*.vbproj - Existing project files
Exclude Patterns:
  • **/bin/** - Build output directories
  • **/obj/** - Intermediate build files
  • **/node_modules/** - Node.js dependencies

Manual Commands

While Build Buddy works automatically, you can trigger operations manually:

Update Project Files

Command: DotNET Build Buddy: Update Project FilesUpdates all project files based on current source files in the workspace.

Generate Solution

Command: DotNET Build Buddy: Generate Solution FileCreates or updates the solution file with all discovered projects.

Refresh All

Command: DotNET Build Buddy: Refresh All .NET FilesUpdates both project files and the solution file in one operation.

Integration with NuGet Compatibility

The project manager integrates with the NuGet compatibility checker to validate packages during updates:
// From dotnetProjectManager.ts:106
private async checkAllProjectCompatibility(): Promise<void> {
    const projectFiles = await this.findProjectFiles();
    
    for (const projectFile of projectFiles) {
        const projectInfo = await this.readProjectFile(projectFile);
        const targetFramework = projectInfo.targetFramework || 'net8.0';

        if (projectInfo.packageReferences && projectInfo.packageReferences.length > 0) {
            const compatibilityIssues = await this.compatibilityChecker
                .checkProjectCompatibilityEnhanced(
                    projectInfo.packageReferences,
                    targetFramework
                );

            if (compatibilityIssues.length > 0) {
                await this.compatibilityChecker.reportCompatibilityIssues(compatibilityIssues);
            }
        }
    }
}
Every time project files are updated, Build Buddy automatically checks all NuGet packages for compatibility with your target framework.

Best Practices

Place related source files in the same directory to have them automatically grouped into a single project. Use subdirectories to create separate projects.
Avoid manually editing the <ItemGroup> sections that contain file references. Build Buddy will automatically manage these based on your directory structure.
You can safely add custom MSBuild properties, package references, and other configurations. Build Buddy preserves these when updating project files.
While Build Buddy supports multiple frameworks, using consistent target frameworks across your workspace makes dependency management easier.

Troubleshooting

If project files aren’t being generated, ensure your workspace contains .NET source files (.cs, .fs, or .vb) outside of bin/, obj/, or node_modules/ directories.
Common Issues:
  1. No projects generated - Check that source files exist and aren’t in excluded directories
  2. Settings not preserved - Verify your custom properties are in the main <PropertyGroup>
  3. Wrong project type - Ensure file extensions are correct (.cs, .fs, .vb)

Build docs developers (and LLMs) love