Remotesoft protector is one of the best code protection tools out there. In fact, its pretty much the only one that really works. Since I moved to .NET 4.0 I’ve been getting an annoying error when attempting to protect my binaries using the 4.0 suite of tools (with the updated protector runtime). Everything still runs – it just pops up nasty alert boxes on load which is no good
Remotesoft Protector Runtime Error – yet to handle multiple .NET framework runtime
One other symptom of this was that .exe files would just blow chunks. I’ve finally figured out what was causing this! Most of our products are protected during the nightly builds. This error however is specific to assemblies protected using the the Remotesoft .NET Explorer UI. When using this application for the protect or obfuscate functionality it is really just a front end around the protector.exe/obfuscator.exe. The UI is building the following command line string and tonight it finally dawned on me:
Command: C:\Program Files (x86)\Remotesoft\Protector\bin\protector.exe -neutral -resource -string -cctor -clrversion v2.0.50727 "C:\temp\SmartInk for Kahua\SmartInk.UI.exe"
The UI was forcing the clr version to .NET 2.0 – when my assemblies are all built against .NET 4.0. Oops…
After a bit of digging I found that you can set the CLR version in .NET Explorer from the Action / CLR Version menu item. Unfortunately it has not been updated to support .NET 4.0 – and so has been rendered pretty much useless as a front end for protector.
The only solution is to use the command line to execute your protection. The updated command line ended up looking pretty similar:
"C:\Program Files (x86)\Remotesoft\Protector\bin\protector.exe" -neutral -resource -string -clrversion v4.0.30319 "C:\temp\SmartInk for Kahua\SmartInk.UI.exe"
There you have it – I can’t believe I missed that…