How to protect your .net software code with ILProtector?
- 2018-02-22 10:35:15
ILProtector is actively developed and maintained by vgrsoft.com. ILProtector first started as free software that focused on protecting .Net code from reverse engineering. Now its latest version is paid software (more info about licensing here), obviously still a great software with more protection options. But we are still in luck as we can use its older version freely. Another great thing about this softwares is that it provides Command Line Interface (CLI) so we can integrate it very easily as we want in third party tools like we will use it in Visual Studio.
Here are some of the ways we can protect our .Net software by using ILProtector
Note: Please create a backup of your software before proceeding.
By using ILProtector’s main interface
Select your software by clicking + icon
Now click properties icon to open properties. Here you can change settings if you want to embed protecting dll into your software or keep them separate with other settings. Click Save
Now comming back on main interface, click Process button to protect the software. This will generate your software that is protected against know decompilers like IL DASM, .NET Reflector, ILSpy, dotPeek etc
By using ILProtector with CMD
Start -> type cmd -> Open cmd
When cmd is open, type folloing command (change output folder and exe path with yours)
ILProtector.exe -out="c:\ouput folder" -nogui -embed-dlls "c:\myprogram.exe"
Hit Enter key on keyboard, this will generate the protected version of your software.
By using Build Events in Visual Studio
Open your project in Visual Studio.
Open Project -> Properties -> Build Events
In Post Build event type following command. (replace all paths and exe names with yours)
ILProtector -out="$(SolutionDir)My Software\bin\Release" -nogui -embed-dlls "$(SolutionDir)My Software\bin\Release\My Software.exe"
Note: You should include ILProtector's directory path in Enviromment Variable which in my case was C:\Program Files (x86)\VgrSoft\ILProtector