Build Requirements
Visual Studio
Visual Studio 2015 Community Edition or later
.NET Framework
.NET Framework 3.5 (default target)
SharpWMI has been built against .NET Framework 3.5 for maximum compatibility with older Windows systems. You can retarget to .NET 4.0 or later if needed.
Compilation Steps
1
Clone the Repository
2
Open in Visual Studio
Open the Or use the File menu in Visual Studio:
SharpWMI.sln solution file in Visual Studio:- File → Open → Project/Solution
- Navigate to
SharpWMI.sln - Click Open
3
Select Build Configuration
Choose the Release configuration for production builds:
- In the toolbar, locate the configuration dropdown (typically shows “Debug”)
- Change it to Release
- Ensure the platform is set to Any CPU or x64 as appropriate
4
Build the Solution
Build the project:
- Menu: Build → Build Solution
- Keyboard: Ctrl + Shift + B
5
Verify the Build
Test the compiled binary:You should see the usage information displayed.
Build Configurations
- Release Build
- Debug Build
Recommended for operational use:
- Optimized code
- No debug symbols
- Smaller file size
- Better performance
Retargeting .NET Framework Version
If you need to target a different .NET Framework version:1
Open Project Properties
- Right-click on the SharpWMI project in Solution Explorer
- Select Properties
2
Change Target Framework
- Navigate to the Application tab
- In the Target framework dropdown, select your desired version:
- .NET Framework 3.5 (default)
- .NET Framework 4.0
- .NET Framework 4.5
- .NET Framework 4.6 or later
3
Rebuild
Rebuild the solution after changing the target framework:
Command-Line Build
You can also build SharpWMI using MSBuild from the command line:- Using MSBuild
- Using Developer Command Prompt
Code Signing (Optional)
For operational security, you may want to sign the compiled binary:Generate Self-Signed Certificate
Generate Self-Signed Certificate
Sign the Binary
Sign the Binary
Self-signed certificates won’t bypass security controls but may help with application whitelisting in some environments.
Obfuscation (Optional)
Consider obfuscating the binary for operational use:ConfuserEx
Free .NET obfuscator
- Rename symbols
- Control flow obfuscation
- String encryption
InvisibilityCloak
C# obfuscation specifically for offensive tools
- Randomizes method names
- Encrypts strings
- Compatible with offensive tooling
Troubleshooting Build Issues
Missing .NET Framework 3.5
Missing .NET Framework 3.5
Error: “The reference assemblies for framework .NETFramework,Version=v3.5 were not found”Solution:
NuGet Package Restore Failed
NuGet Package Restore Failed
Error: “NuGet package restore failed”Solution:
Build Errors After Retargeting
Build Errors After Retargeting
Error: Various compilation errors after changing target frameworkSolution:
- Clean the solution: Build → Clean Solution
- Delete
binandobjfolders - Rebuild: Build → Rebuild Solution
MSBuild Not Found
MSBuild Not Found
Error: “MSBuild is not recognized as an internal or external command”Solution:
Build Automation
Example PowerShell script to automate the build process:Pre-Built Binaries
This is intentional to:- Prevent malware distribution
- Ensure you review the code
- Allow customization for your environment
- Avoid antivirus signatures on official releases