> ## Documentation Index
> Fetch the complete documentation index at: https://docs.specterops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Instructions

> Complete guide to building SharpSCCM from source code

> [!WARNING]
>
> **Legal Notice**: Only build and use SharpSCCM in authorized environments. Ensure you have proper permission before compiling or executing this tool.

## Prerequisites

> [tab] Development Environment
>
> **Required Software:**
>
> * Visual Studio 2019 or later (Community Edition is sufficient)
> * .NET Framework 4.8 or later
> * Git client (for cloning the repository)
> * Windows 10/11 or Windows Server 2016+ (recommended)
>
> **Optional but Recommended:**
>
> * Visual Studio Code (for quick edits)
> * GitHub Desktop (for easier repository management)
> * Windows SDK (for advanced debugging)

> [tab] Visual Studio Workloads
>
> **Required Workloads:**
>
> * .NET desktop development
> * Game development with C# (for MSBuild tools)
>
> **Required Individual Components:**
>
> * .NET Framework 4.8 targeting pack
>
> * MSBuild
>
> * NuGet package manager
>
> * Git for Windows
>
> > [!TIP]
> >
> > **Installation Tip**: You can install these components through the Visual Studio Installer under "Individual components"

> [tab] System Requirements
>
> **Minimum System Requirements:**
>
> * 4 GB RAM (8 GB recommended)
> * 2 GB free disk space
> * Windows 10 version 1909 or later
> * .NET Framework 4.8
>
> **Recommended Configuration:**
>
> * 16 GB RAM for faster builds
> * SSD storage for improved compile times
> * Multi-core processor for parallel builds

## Step-by-Step Build Process

**1. Clone the Repository**

Open a command prompt or PowerShell terminal and clone the repository:

```bash Command Line theme={null}
git clone https://github.com/Mayyhem/SharpSCCM.git
cd SharpSCCM
```

```powershell PowerShell theme={null}
git clone https://github.com/Mayyhem/SharpSCCM.git
Set-Location .\SharpSCCM
```

> [!NOTE]
>
> **Alternative**: You can also download the source as a ZIP file from GitHub if you prefer not to use Git.

**2. Open the Solution**

Launch Visual Studio and open the solution file:

* File → Open → Project/Solution
* Navigate to the cloned repository directory
* Select `SharpSCCM.sln`

> [!TIP]
>
> **Quick Tip**: You can also double-click the `.sln` file in Windows Explorer to open it directly in Visual Studio.

**3. Configure Build Settings**

Select your target configuration and platform:

**Recommended Settings:**

* **Configuration**: Release (for production use)
* **Platform**: x64 (for better compatibility)
* **Target Framework**: .NET Framework 4.8

> [accordion] Configuration Options Explained
>
> * **Debug**: Includes debugging symbols, larger file size, slower execution
> * **Release**: Optimized build, smaller file size, faster execution
> * **AnyCPU**: Runs on both x86 and x64 (may have compatibility issues)
> * **x64**: Specifically targets 64-bit systems (recommended)
> * **x86**: Targets 32-bit systems (legacy compatibility)

**4. Restore NuGet Packages**

Before building, restore all required dependencies:

* Right-click on the solution in Solution Explorer
* Select "Restore NuGet Packages"
* Wait for the restore process to complete

```bash Package Manager Console theme={null}
Update-Package -reinstall
```

```bash Command Line theme={null}
nuget restore SharpSCCM.sln
```

**5. Build the Solution**

Build the complete solution:

* Press `Ctrl + Shift + B`, or
* Go to Build → Build Solution, or
* Right-click solution → Build Solution

**Expected Output Location:**

```
.\SharpSCCM\bin\x64\Release\SharpSCCM.exe
```

> [!NOTE]
>
> The output will be a merged assembly containing all dependencies, making it a standalone executable.

## Build Configurations

> [accordion] Release Build (Recommended)
>
> **Best for production use and deployment**
>
> ```bash theme={null}
> Configuration: Release
> Platform: x64
> Optimizations: Enabled
> Debug Info: None
> ```
>
> **Characteristics:**
>
> * Smaller file size
> * Better performance
> * No debugging symbols
> * Suitable for deployment

> [accordion] Debug Build
>
> **Best for development and troubleshooting**
>
> ```bash theme={null}
> Configuration: Debug
> Platform: x64
> Optimizations: Disabled
> Debug Info: Full
> ```
>
> **Characteristics:**
>
> * Larger file size
> * Includes debugging symbols
> * Easier to troubleshoot
> * Better for development

> [accordion] Custom Build Options
>
> **Advanced configuration options**
>
> You can customize builds by editing the project properties:
>
> * Right-click project → Properties
> * Modify compilation constants
> * Adjust optimization settings
> * Configure post-build events

## Troubleshooting Common Issues

> [accordion] Red Underlines in Code
>
> **Issue**: Visual Studio shows red underlines under code elements
>
> **Solution**: This is usually a temporary IntelliSense issue:
>
> 1. Try building the solution anyway (`Ctrl + Shift + B`)
> 2. Clean and rebuild: Build → Clean Solution, then Build → Rebuild Solution
> 3. Close and reopen Visual Studio
> 4. Clear Visual Studio cache: Delete `bin` and `obj` folders

> [accordion] Missing Dependencies
>
> **Issue**: Build fails with missing assembly references
>
> **Solutions**:
>
> 1. **Restore NuGet packages**: Tools → NuGet Package Manager → Package Manager Console, then run `Update-Package -reinstall`
> 2. **Check .NET Framework version**: Ensure you have .NET Framework 4.8 installed
> 3. **Verify Windows SDK**: Install the latest Windows SDK if needed
> 4. **Clear NuGet cache**: `nuget locals all -clear`

> [accordion] Build Errors
>
> **Issue**: Compilation errors during build
>
> **Common Solutions**:
>
> 1. **Update Visual Studio**: Ensure you're using a recent version
> 2. **Check target framework**: Verify .NET Framework 4.8 is selected
> 3. **Clean solution**: Build → Clean Solution, then rebuild
> 4. **Check file permissions**: Ensure write access to the project directory
> 5. **Antivirus interference**: Temporarily disable real-time protection during build

> [accordion] Post-Build Issues
>
> **Issue**: Build succeeds but executable doesn't work properly
>
> **Troubleshooting Steps**:
>
> 1. **Check dependencies**: Ensure all required DLLs are present
> 2. **Run as administrator**: Some features require elevated privileges
> 3. **Test in clean environment**: Try running on a different machine
> 4. **Check .NET version**: Target system must have .NET Framework 4.8
> 5. **Verify architecture**: Ensure x64 build on x64 systems

## Build Optimization

> [tab] Performance Optimizations
>
> **Speed up build times:**
>
> 1. **Enable parallel builds**:
>    * Tools → Options → Projects and Solutions → Build and Run
>    * Set "maximum number of parallel project builds" to your CPU core count
>
> 2. **Use SSD storage** for faster I/O operations
>
> 3. **Increase memory allocation**:
>    ```xml theme={null}
>    <PropertyGroup>
>      <MSBuildArguments>/m /p:UseSharedCompilation=false</MSBuildArguments>
>    </PropertyGroup>
>    ```
>
> 4. **Exclude directories from antivirus scanning**:
>    * Add your development folder to antivirus exclusions
>    * Exclude Visual Studio processes from real-time scanning

> [tab] Output Customization
>
> **Customize build output:**
>
> **Post-build events** (Project Properties → Build Events):
>
> ```batch theme={null}
> rem Copy to custom directory
> copy "$(TargetPath)" "C:\Tools\SharpSCCM.exe"
>
> rem Create checksums
> certutil -hashfile "$(TargetPath)" SHA256 > "$(TargetDir)checksums.txt"
> ```
>
> **Custom output paths**:
>
> * Modify project properties to change default output directory
> * Use environment variables for dynamic paths
> * Configure conditional compilation symbols

> [tab] Security Considerations
>
> **Building securely:**
>
> 1. **Verify source integrity**:
>    ```bash theme={null}
>    git log --oneline -10
>    git status
>    ```
>
> 2. **Build in isolated environment**:
>    * Use virtual machines for building
>    * Scan built executables with antivirus
>    * Verify cryptographic signatures
>
> 3. **Code signing** (optional):
>    * Obtain code signing certificate
>    * Configure post-build signing
>    * Verify signatures before distribution

## Verification & Testing

**1. Verify Build Success**

After a successful build, verify the output:

```powershell theme={null}
# Check if file exists and get file info
Get-ChildItem ".\SharpSCCM\bin\x64\Release\SharpSCCM.exe" | Select-Object Name, Length, LastWriteTime

# Verify .NET Framework version
[System.Reflection.Assembly]::LoadFile("$PWD\SharpSCCM\bin\x64\Release\SharpSCCM.exe").ImageRuntimeVersion
```

**2. Basic Functionality Test**

Test basic functionality to ensure the build works:

```bash theme={null}
# Display help information
.\SharpSCCM.exe --help

# Test local site information (safe command)
.\SharpSCCM.exe local site-info
```

> [!WARNING]
>
> Only run these tests in authorized lab environments.

**3. Environment Validation**

Ensure the built executable works in your target environment:

* Test on different Windows versions
* Verify SCCM client compatibility
* Check domain/workgroup scenarios
* Validate privilege requirements

## Alternative Build Methods

> [accordion] Command Line Build (MSBuild)
>
> Build from command line using MSBuild:
>
> ```bash theme={null}
> # Navigate to project directory
> cd SharpSCCM
>
> # Build using MSBuild
> msbuild SharpSCCM.sln /p:Configuration=Release /p:Platform=x64
>
> # Or use dotnet CLI if available
> dotnet build SharpSCCM.sln --configuration Release
> ```
>
> **Advantages:**
>
> * Scriptable builds
> * CI/CD integration
> * Consistent build environment

> [accordion] Docker Build Environment
>
> Use Docker for consistent build environments:
>
> ```dockerfile theme={null}
> FROM mcr.microsoft.com/dotnet/framework/sdk:4.8
> WORKDIR /src
> COPY . .
> RUN msbuild SharpSCCM.sln /p:Configuration=Release /p:Platform=x64
> ```
>
> **Benefits:**
>
> * Reproducible builds
> * Isolated environment
> * Cross-platform development support

## Next Steps

> [card] [Command Line Usage](https://docs.specterops.io/sharpsccm-docs/resources/Command-Line-Usage.md)
>
> Learn how to use SharpSCCM effectively

> [card] [Get Started with Commands](https://docs.specterops.io/sharpsccm-docs/commands/get)
>
> Begin with information gathering commands

> [card] [Security Considerations](https://docs.specterops.io/sharpsccm-docs/security/defensive-recommendations)
>
> Understand defensive measures and detection

> [card] [GitHub Repository](https://github.com/Mayyhem/SharpSCCM)
>
> Access source code and report issues

> [!NOTE]
>
> **Need Help?** If you encounter build issues not covered here, check the [GitHub Issues](https://github.com/Mayyhem/SharpSCCM/issues) or create a new issue with your build environment details.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.