Skip to main content

Build Requirements

Required:
  • Visual Studio 2015 Community Edition or later
  • .NET Framework 3.5 or 4.0
  • C# 8.0 language features support
Recommended:
  • Visual Studio 2019 or 2022 Community Edition
  • Windows SDK for target OS version
Seatbelt is built against .NET Framework 3.5 and .NET Framework 4.0 by default.Both versions are compatible with:
  • Windows 7 and later
  • Windows Server 2008 R2 and later
Seatbelt uses C# 8.0 features including:
  • Nullable reference types
  • Pattern matching enhancements
  • Using declarations
  • Static local functions

Compilation Steps

1

Clone or Download Source

Obtain the Seatbelt source code:
git clone https://github.com/GhostPack/Seatbelt.git
2

Open Solution

Open Seatbelt.sln in Visual Studio:
  • Navigate to the project directory
  • Double-click Seatbelt.sln
  • Or open through Visual Studio: File → Open → Project/Solution
3

Select Configuration

Choose the build configuration:
  • Configuration: Select Release (recommended for deployment)
  • Platform: Select Any CPU or target architecture (x86/x64)
4

Build Project

Compile the project:
  • Menu: Build → Build Solution
  • Keyboard: Ctrl + Shift + B
  • Command: dotnet build (if using .NET CLI)
5

Locate Binary

Find the compiled executable:
.\Seatbelt\bin\Release\Seatbelt.exe

Build Configurations

Release vs Debug

Recommended for operational useOptimizations:
  • Code optimization enabled
  • Debug symbols removed
  • Smaller binary size
  • Better performance
Output: .\Seatbelt\bin\Release\Seatbelt.exe

Changing Target Framework

To change the target .NET Framework version:
1

Open Project Properties

  • Right-click on the Seatbelt project in Solution Explorer
  • Select Properties
2

Modify Target Framework

  • Navigate to the Application tab
  • Under Target framework, select desired version:
    • .NET Framework 3.5
    • .NET Framework 4.0
    • .NET Framework 4.5+
3

Rebuild Project

  • Save changes
  • Build → Rebuild Solution
Framework Selection Guidance:
  • .NET 3.5 - Maximum compatibility with older Windows systems
  • .NET 4.0 - Better performance, still broadly compatible
  • .NET 4.5+ - Modern features, requires Windows 8+ / Server 2012+

Build from Command Line

Using MSBuild

# Navigate to solution directory
cd path\to\Seatbelt

# Build release configuration
msbuild Seatbelt.sln /p:Configuration=Release /p:Platform="Any CPU"

# Build for specific framework
msbuild Seatbelt.sln /p:Configuration=Release /p:TargetFrameworkVersion=v3.5

Using .NET CLI

# Restore dependencies
dotnet restore

# Build release
dotnet build --configuration Release

# Publish standalone
dotnet publish --configuration Release --self-contained false

Build Optimization Options

Performance Optimizations

For operational use, consider these optimizations:
<PropertyGroup>
  <Configuration>Release</Configuration>
  <Optimize>true</Optimize>
  <DebugType>none</DebugType>
  <DebugSymbols>false</DebugSymbols>
</PropertyGroup>

Obfuscation Considerations

For operational security, consider:
  • Renaming the output binary
  • Using obfuscation tools (ConfuserEx, .NET Reactor)
  • Stripping metadata and debug information
  • Packing/compressing the executable

Customization Before Building

Adding Custom Commands

1

Use Template

Copy the command template:
.\Seatbelt\Commands\Template.cs
2

Create Command

Implement your custom command class:
namespace Seatbelt.Commands
{
    class MyCustomCommand : CommandBase
    {
        public override string Command => "MyCustom";
        // Implementation here
    }
}
3

Add to Project

  • Place in appropriate .\Seatbelt\Commands\ subdirectory
  • Add file to project in Solution Explorer
  • Rebuild project

Modifying Command Groups

Edit command group definitions in the source:
// Define custom command group
public static readonly string[] CustomGroup = new string[]
{
    "OSInfo",
    "LocalUsers",
    "Processes"
};

Common Build Issues

Error: “The target framework version is not supported”Solution:
Error: “Feature ‘X’ is not available in C# 7.3”Solution: Update language version in project file:
<PropertyGroup>
  <LangVersion>8.0</LangVersion>
</PropertyGroup>
Error: “The type or namespace name ‘X’ could not be found”Solution:
  • Restore NuGet packages: Right-click solution → Restore NuGet Packages
  • Or: Tools → NuGet Package Manager → Restore
Warning: “Platform target warning”Solution: Set platform target explicitly:
  • Project Properties → Build → Platform target → Any CPU
  • Or set to x64/x86 as needed

Build Artifacts

After successful compilation:
.\Seatbelt\bin\Release\
├── Seatbelt.exe          # Main executable
├── Seatbelt.exe.config   # Configuration file
└── [dependencies]        # Any required DLLs
Binary Size:
  • Release build: ~400-600 KB
  • Debug build: ~800 KB - 1 MB
  • Size varies based on .NET version and optimizations

Post-Build Steps

1

Test Build

Verify the executable works:
.\Seatbelt.exe --help
.\Seatbelt.exe OSInfo
2

Sign Binary (Optional)

For organizational use, consider code signing:
signtool sign /f certificate.pfx /p password Seatbelt.exe
3

Prepare for Deployment

  • Copy executable to deployment location
  • Rename if desired for OPSEC
  • Document version and build date

Build Scripts

Automated Build Script

# build.ps1
param(
    [string]$Configuration = "Release",
    [string]$Framework = "net40"
)

Write-Host "Building Seatbelt..." -ForegroundColor Green

# Restore packages
dotnet restore

# Build project
msbuild Seatbelt.sln /p:Configuration=$Configuration /p:TargetFrameworkVersion=$Framework

if ($LASTEXITCODE -eq 0) {
    Write-Host "Build successful!" -ForegroundColor Green
    Write-Host "Output: .\Seatbelt\bin\$Configuration\Seatbelt.exe"
} else {
    Write-Host "Build failed!" -ForegroundColor Red
    exit 1
}

Batch Build Script

@echo off
echo Building Seatbelt...

cd /d "%~dp0"

REM Restore packages
dotnet restore

REM Build release
msbuild Seatbelt.sln /p:Configuration=Release /p:Platform="Any CPU"

if %ERRORLEVEL% EQU 0 (
    echo Build successful!
    echo Output: .\Seatbelt\bin\Release\Seatbelt.exe
) else (
    echo Build failed!
    exit /b 1
)

Troubleshooting

For faster builds:
  • Disable parallel builds if experiencing issues
  • Use SSD for source code location
  • Close unnecessary Visual Studio extensions
  • Increase Visual Studio memory allocation
Security software may interfere with compilation:
  • Add project directory to AV exclusions
  • Temporarily disable real-time protection
  • Use Windows Defender exclusions for development folder

Next Steps

Usage Guide

Learn how to use Seatbelt

Command Reference

Explore available commands

Customization

Create custom modules

GitHub Issues

Report build problems

Additional Resources