You can obfuscate any pure .NET assembly, you just need to create a new SmartAssembly project for the plugin assembly and build it with the protection you want to apply.
If your plugin is a library (.dll) then SmartAssembly will leave all public interfaces, types and methods visible.
If your plugin is an executable (.exe) then SmartAssembly will obfuscate (effectively hiding) everything by default.
You can override the default behavior by using the <ExcludePublicMembers> attribute in the SmartAssembly project file (*.saproj). This enables you to treat EXE files in a similar way to DLL files.
To exclude public members from obfuscation, specify a value of '1' for the project file:
- Code: Select all
<Obfuscation ExcludePublicMembers="1" Obfuscate="1">...
As long as your main exe references the plugin you can embed or merge the plugin.
If you don't have a reference to the plugin in the executable and can't add one (for instance if you want dynamically choose which plugins to load at runtime) then it is not currently possible to embed or merge the the plugin using SmartAssembly.
If you can't embed the plugin you can manually do it, see http://www.codeproject.com/KB/DLL/EmbedAssemblyAsResource.aspx
, although this is more of a pain to do and doesn't do any encryption or compression on the embedded plugin assembly.