Yes, the software protection and licensing process can be fully automated by invoking the PC Guard command-line interface (CLI) with -process and -silent flags, allowing seamless integration into CI/CD workflows.
To automate the protection of a single application or a group of applications, you need to submit the project filename (.pcg) along with the -process and -silent options directly from the command line.
Basic Command Line Syntax
The standard syntax for executing PC Guard via the command-line interface is as follows:
"C:\Program Files (x86)\PC Guard [Edition]\pcguard.exe" -process -silent "C:\Path\To\project.pcg"
Operational Parameters Explained:
-process: Instructs PC Guard to immediately open the specified project file, load all encryption and licensing configuration settings, and execute the protection process automatically.
-silent: Runs the entire automation process in the background without launching the Graphical User Interface (GUI) or displaying any interactive modal dialog boxes. This is a mandatory flag for headless build environments where user interaction is impossible.
Integrating PC Guard into Automated Build Pipelines (CI/CD)
Because PC Guard uses node-locking, you must use self-hosted runners on persistent machines. Cloud-hosted runners (e.g., standard GitHub Actions) will fail due to changing hardware IDs on every build.
The Build Pipeline Order of Operations:
Compile: Your build runner compiles the raw source code into binaries (e.g., standard .exe, cross-platform .dll, or Native AOT executables).
Obfuscate (Optional): If you are deploying high-value C# code, apply code-level obfuscation using SourceArmor right after compilation.
Protect (PC Guard CLI): Execute the PC Guard command-line interface to wrap and encrypt the compiled output. PC Guard must always be the final step before code signing and packaging.
Example: GitHub Actions Pipeline Step (.yml) on a self-hosted agent:
yaml
runs-on: self-hosted
steps:
- name: Harden Binary with PC Guard Anti-Tamper Shield
run: |
& "C:\Program Files (x86)\PC Guard\pcguard.exe" -process -silent "${{ github.workspace }}\build\project.pcg"
shell: powershell
Note: Using ${{ github.workspace }} ensures the command works dynamically across different self-hosted environments.
Error Handling & Exit Codes in Automation
When running unattended builds, detecting whether the protection process succeeded is vital:
Success: If PC Guard finishes encryption successfully, it returns an exit code of 0. Your pipeline will proceed to the packaging and code-signing stages.
Failure: If a hardware lock, invalid PE structure, or missing directory causes an error, PC Guard logs the issue. Ensure your CI/CD runner is configured to catch non-zero exit codes to immediately halt the build and prevent the distribution of unprotected binaries
More info...