NetBlocker uses a unified PowerShell script to build and package the application for all supported platforms.
To build NetBlocker from source, you need:
- .NET 10 SDK or higher installed on your machine.
- PowerShell 7+ (recommended for cross-platform support).
- (Optional) Visual Studio 2022 or VS Code with C# Dev Kit.
From the project root directory, run the following command:
./build-all.ps1- Restores Dependencies: Downloads all required NuGet packages.
- Builds Projects: Compiles the Core, Infrastructure, and UI projects.
- Publishes Binaries: Generates optimized, self-contained executables for:
win-x64(Windows 64-bit)linux-x64(Linux 64-bit)osx-x64(macOS Intel)osx-arm64(macOS Apple Silicon)
- App Bundling (macOS): Automatically creates a
.appbundle structure with the correctInfo.plistand executable permissions.
After a successful build, you will find the results in the publish/ folder:
publish/win-x64/NetBlocker.exepublish/linux-x64/NetBlockerpublish/osx-x64/NetBlockerpublish/NetBlocker-x64.app(macOS Intel App Bundle)publish/NetBlocker-arm64.app(macOS Apple Silicon App Bundle)
The build script itself does not require admin privileges, but the resulting application does. This is because it needs to interact with the system's low-level firewall APIs (netsh, iptables, pfctl).
The build-all.ps1 script creates the .app bundle structure but does not perform code signing or notarization. If you are distributing this app to others, you may need to sign it using your developer certificate:
codesign --force --deep --sign "Your Developer ID" publish/NetBlocker-x64.appWhile .NET supports cross-compilation for most platforms, it's always best to verify the final build on the target operating system.