Automate .NET obfuscation in CLI builds
Once a protection job works in the desktop app, save it as a .cfsprj project and run the same settings from the CLI. Check the deployment preview before adding the command to your build pipeline.
Validate the project in the desktop app
- Add the managed DLL or EXE, choose a preset and exclusions, and set an output location.
- Protect the app once and test behavior and speed on a target machine.
- Save
MyApp.cfsprj. Under Output location → Generate CLI command, copy the PowerShell or CMD form for your setup.
The project contains input paths and deployment settings. Make sure those paths exist on the build machine. The license is bound to one PC, so check its status under the account and machine that run the automated job.
PowerShell example
Run these commands from the root of the Confuser Studio installation. Replace the project path and output folder with your own.
& '.\cli\Confuser.Cli.exe' '.\MyApp.cfsprj' --preview-deployment
& '.\cli\Confuser.Cli.exe' '.\MyApp.cfsprj' --output 'D:\Protected'
& '.\cli\Confuser.Cli.exe' --license-status
--preview-deployment reports inputs and excluded files as JSON. Use --diagnostics when investigating a failure. A CI step should stop if the CLI returns an error:
& '.\cli\Confuser.Cli.exe' '.\MyApp.cfsprj' --output 'D:\Protected'
if ($LASTEXITCODE -ne 0) { throw 'Confuser Studio protection failed' }
Keep deployment and diagnostic files separate
| Folder | Handling |
|---|---|
deployment | Contains the files to deploy. Check whether your app still needs original configuration, data, or native DLLs. |
private | Contains name maps and reports. Retain these with the matching release; do not distribute them with customer files. |
Before enabling CI
- Can the same source build and project file complete a local protection job?
- Can the build account check the license and write to the output folder?
- Does the protected app run on the target system, with acceptable first and repeated-call times?
- Are the private name maps retained for the exact release you ship?
See the complete CLI manual for the command generator and option details.