From: http://www.cnblogs.com/rickie/archive/2009/11/13/1602239.html
{Smartassembly }-Confuse your assembly code with the Wizard
Smartassembly provides a method to optimize and confuse your. Net assembly, protect your work and software, reduce the size of the distribution package, and improve program performance. Visual Studio 2003/2005/2008 integrates a small tool for the dotfuscator community edition, which has simple functions and is easy to use. For detailed operations, see the following article: Use of dotfuscator in Visual Studio 2008
Here, demonstrate the use of the smartassembly obfuscation tool, the tool features relatively strong (http://www.smartassembly.com), has been acquired by Redgate, interested friends can download. The following describes the procedure.
1. Start the smartassembly application, enter the main interface, and click the new project button to create a new project.
2. Select the main assembly to be improved and protected. It can be a Windows Forms Application, WPF application, console program, DLL assembly, ASP. NET web application, and so on.
Here, I will demonstrate how to protect an ASP. NET web application. Click the Browse Assembly button and select the Assembly after the web application is compiled.
3. After selecting the main assembly, return to the smartassembly interface, as shown in. Set the location where the Assembly is stored after being processed by smartassembly. Click set destination.
4. Set the program parameters of smartassembly one by one. The first one is dependencies merging, which sets other related assemblies on which the main assembly depends.
For this example, select
Biz/DAC/entity/common dependent assembly. What's amazing is that these dependent assembly programs are merged into the main assembly. In this way, you only need to publish the main program during the release, and the dependent assembly does not need to be released together.
In addition, we recommend that you do not select a third-party assembly, as shown in. We do not need to select an Assembly related to the Enterprise Library. In this way, third-party Assembly needs to be protected when applications are published.
5. pruning streamline the Code. This step will delete unused code and metadata from the Assembly. Smartassembly checks the code in the Assembly to automatically determine which code is useful and which code is never executed. At the same time, useless metadata will be removed. You can also select the master assembly and the dependent assembly for simplified code operations.
Here, I did not select any assembly. If you are interested, try it.
6. obfuscation code
Obfuscation code is the most important way to protect your assembly. It changes the names of classes and methods to unreadable characters, but does not change the functions of the Code to protect the code. At the same time, the metadata can be reduced to reduce the Assembly size.
Here, I select the main assembly and all dependent assembly for obfuscation, as shown in.
There are
Types/methods name and fields name obfuscation settings. Keep the default value here.
There are many other options later. Here we will explain them one by one. If you are interested, you can check them yourself. These settings are sufficient to protect the released application code.
7. Build output obfuscated assembly
Click the build button to output the obfuscated assembly, and all the dependent assembly is merged, so that at the time of release, you only need to publish a merged assembly and a third-party assembly. In addition, you can also see that the size of the obfuscation/merging assembly must be smaller.
The latest version of smartassembly is available on csdn. You can download it and try it out, or download an evaluation version from the official website of smartassembly.
Finally, let's look at the decompilation effect in reflector. The decompilation code is too big.
In the smartassembly setting, there is an other protections option. You can add some incorrect metadata streams, as shown in, so that the Assembly cannot be opened when you use the reflector decompilation tool.