SmartAssembly - 5.5

SmartAssembly

Learning SmartAssembly - 5.5

Using SmartAssembly with a WPF assembly

SmartAssembly supports protecting WPF (Windows Presentation Foundation) assemblies.

Because the format for BAML files is proprietary and not public, SmartAssembly cannot create a new BAML file that contains an obfuscated XAML file. This means that your XAML file remains unchanged.

To ensure that your XAML file still works with the obfuscated assembly, SmartAssembly excludes some classes/methods from the obfuscation. If you call other members by reflection from your XAML files, you may need to exclude them manually.

To decide whether this is required, process the assembly with SmartAssembly, as follows:

  1. On project settings page, under Obfuscation, select the I want to obfuscate using only ASCII characters name mangling option.
  2. Build your assembly
  3. Run your application. If it runs normally, you do not need to exclude any other members. If required, you can increase the obfuscation level in SmartAssembly and then rebuild your assembly.
  4. If your application fails, note the ASCII obfuscated name in the error message.
  5. Type the obfuscated name into the Decode Stack Trace feature in SmartAssembly. This will give you the de-obfuscated name of the class or method that you need to exclude.
  6. Exclude the class or method either in the SmartAssembly project settings or by using custom attributes directly in your code.

Troubleshooting WPF assembly protection

If you want to merge a dependency that uses WPF into your main assembly, the assembly-qualified name of the types in it change after the merging. If the assembly-qualified name of a type is used in a XAML file, the WPF engine may no longer be able to find those types in your assembly, so the application will no longer work.

If you experience this problem, you can use dependencies embedding instead of dependencies merging.

Was this article helpful?

Search support
Forums
Visit the SmartAssembly forum.

SmartAssembly

all products