Skip to content

Building from Source

knoxxr edited this page Jul 14, 2026 · 1 revision

Building from Source

Requirements

  • .NET 8 SDK
  • NetworkScanner (WPF) and SetupNetworkScanner (.vdproj) build/run on Windows only.
  • NetworkScanner.Avalonia, NetworkScanner.Core, and NetworkScanner.Tests build and run on Windows / macOS / Linux.

Build

# Full solution build — only works on Windows (includes the WPF project)
dotnet build NetworkScanner.sln

# On macOS/Linux the WPF project can't run, but you can still compile-check
# the whole solution:
dotnet build NetworkScanner.sln -p:EnableWindowsTargeting=true

Run

# Cross-platform Avalonia app (Windows / macOS / Linux)
dotnet run --project NetworkScanner.Avalonia

# Headless CLI
dotnet run --project NetworkScanner.Cli -- --range 192.168.1.0/24 --ports 22,80,443

Tests

# xUnit — Core-only, runs on any OS
dotnet test NetworkScanner.Tests/NetworkScanner.Tests.csproj

# A single test
dotnet test NetworkScanner.Tests/NetworkScanner.Tests.csproj \
  --filter "FullyQualifiedName~ScanEngineTests.ComputeIPCount_RangeCrossingSubnetBoundary_CountsCorrectly"

NetworkScanner.Tests references only NetworkScanner.Core, so it runs on non-Windows environments too. Keep test-worthy logic in Core. Tests set UserDataPaths.OverrideRoot instead of touching the real profile.

Packaging for distribution

Single self-contained executable (Avalonia)

dotnet publish NetworkScanner.Avalonia/NetworkScanner.Avalonia.csproj -c Release -r win-x64   --self-contained true
dotnet publish NetworkScanner.Avalonia/NetworkScanner.Avalonia.csproj -c Release -r osx-arm64 --self-contained true
dotnet publish NetworkScanner.Avalonia/NetworkScanner.Avalonia.csproj -c Release -r linux-x64 --self-contained true

Installer packages (Velopack)

The vpk CLI wraps the publish output into per-OS installers. vpk can only build a package for the OS it runs on (no cross-packaging), so each package must be built on its own OS.

dotnet tool install -g vpk   # once
export PATH="$PATH:$HOME/.dotnet/tools"

dotnet publish NetworkScanner.Avalonia/NetworkScanner.Avalonia.csproj -c Release -r osx-arm64 \
  --self-contained true -o publish/osx-arm64

vpk pack --packId NetworkScanner --packVersion 1.0.0 \
  --packDir publish/osx-arm64 --mainExe NetworkScanner.Avalonia \
  --packTitle "Network Scanner" --packAuthors SMIC \
  --runtime osx-arm64 --outputDir release-packages/osx-arm64

On Windows, add --mainExe NetworkScanner.Avalonia.exe and --icon NetworkScanner/img/Kyo-Tux-Delikate-Network.ico to produce an installer with the app icon.

CI / Releases

Two GitHub Actions workflows:

  • .github/workflows/build-and-test.yml — on every push/PR, verifies tests + build + packaging and stores artifacts (expire after 90 days).
  • .github/workflows/release.yml — on a v*.*.* tag push, runs publish + vpk pack on the Windows/macOS/Linux runners and attaches the installers to a GitHub Release. dotnet publish -p:Version=<tag> stamps the real version; both UIs show ver. Major.Minor.Build in the sidebar.

Installers are unsigned — expect Gatekeeper/SmartScreen/AV false-positive warnings (see Troubleshooting & FAQ).

For an overview of how the projects fit together, see Architecture.

Clone this wiki locally