問題描述
Dotfuscator có vẻ như không tuân theo việc đổi tên RegEx (Dotfuscator Seems Not Adhering To Renaming Exclusion RegEx)
We have decided to use the Dotfuscator to obfuscate our code. Ours is a Windows Phone application and we are using Dotfuscator Windows Phone Edition Version 4.9.7000.29303. We learnt that System.Reflection.ObfuscationAttribute class is not available in Silverlight, so it is not possible to use exclusion attributes on some types we need to exclude. We are now planning to use Rename>Exclude tab in dotfuscator and exclude types with some specific suffixes. Before implementation we created a trial project and tested obfuscation on it. We found in our testing that the output is not adhering to execution rules. Though the preview window is showing expected result but output still includes those types which should have been excluded. Please see the screen shot of the Dotfuscator window below. Preview window on the left hand side of the arrow is correctly displaying the shaded type which would be excluded from obfuscation, but on the right hand side of the arrow, output of the same still obfuscated those types. What is happening?
參考解法
方法 1:
I don't entirely understand what you're trying to accomplish with the regular expression, but as far as using attributes to control obfuscation, there is a library you can include.
The library to include is typically in
C:\Program Files(x86)\PreEmptive Solutions\Dotfuscator (version and edition)\Attributes\Windows Phone\PreEmptive.ObfuscationAttributes.dll
Here is an example on how to exclude something from renaming for instance:
[Obfuscation(Feature = "renaming", Exclude = true)]
public int Foo{get;set;}
You can find more details about it controlling obfuscation with attributes at this link and the general users guide is available here
If you want to go the regex route instead, you can also look at the documentation for creating custom rules. You'll have to provide a bit more info for me to understand what you're trying to do for me to be able to help though. Given your screenshot, everything appears to be what I'd expect.