I hinted a little about the obfuscation features in Visual Studio 2008 in Chapter 1 and Chapter 5, but it's high time we actually took a look at the features. Visual Studio includes a stripped-down version of Dotfuscator from a company named PreEmptive Solutions (not a part of Microsoft—yet). To access the program, use the Tools → Dotfuscator Community Edition menu command in Visual Studio. The main interface appears in Figure 22-2.
Figure 22-2. It's time to obfuscate!
As of this writing, Dotfuscator Community Edition is not included with Visual Basic 2008 Express Edition.
Even though this is the basic version of the product, you can see that it has a gazillion options. If you want to dive into its enhanced features for your project, that's fantastic. I'll just cover the basic usage here.
Let's recall quickly why you would want to obfuscate your code, or even use the word obfuscate in mixed company. Here's some code from the Library Project:
Public Function CenterText(ByVal origText As String, _ ByVal textWidth As Integer) As String ' ----- Center a piece of text in a field width. ' If the text is too wide, truncate it. Dim resultText As String resultText = Trim(origText) If (Len(resultText) >= textWidth) Then ' ----- Truncate as needed. Return Trim(Left(origText, textWidth)) Else ' ----- Start with extra spaces. Return Space((textWidth - Len(origText)) \ 2) & _ resultText ...