简体   繁体   English

如何防止所有类的重命名,dotfuscator中的接口

[英]How to prevent renaming of all classes, interface in dotfuscator

I am following a MSDN site https://msdn.microsoft.com/en-us/library/hh977082(v=vs.107).aspx for obfuscating my c# code using the dotfuscator that comes free with VS. 我正在关注MSDN网站https://msdn.microsoft.com/en-us/library/hh977082(v=vs.107).aspx ,使用随VS免费提供的dotfuscator来混淆我的c#代码。

In my C# projects, I have used Dependency Injection (Castle.Windsor) so my application crashed after the obfuscation. 在我的C#项目中,我使用了依赖注入(Castle.Windsor),因此我的应用程序在混淆后崩溃了。

I am thinking about not renaming any of my classes and interface name including constructors but let their methods, variables rename would solve the problem. 我正在考虑不重命名我的任何类和接口名称,包括构造函数,但让他们的方法,变量重命名将解决问题。 I am trying to set the exclusion rule for this in the dotfuscator but still not able to do so. 我试图在dotfuscator中为此设置排除规则,但仍然无法这样做。

Could you please let us know how to set the exclusion rule that prevent renaming of classes and interface names along with its constructors but let their methods and variable get renamed in dotfuscator? 您能否告诉我们如何设置排除规则以防止重命名类和接口名称及其构造函数,但是让他们的方法和变量在dotfuscator中重命名? I am using the dotfuscator that comes with VS2015. 我正在使用VS2015附带的dotfuscator。

The Renaming documentation for Dotfuscator Community Edition gives general instructions for how to do renaming exclusions like this. Dotfuscator Community Edition重命名文档提供了有关如何重命名此类排除项的一般说明。 It sounds like, in this case, you should add a Type exclusion. 听起来,在这种情况下,您应该添加类型排除。 That will just exclude the types themselves (and their constructors) without excluding any methods/fields/properties. 这将只排除类型本身(及其构造函数)而不排除任何方法/字段/属性。 Type exclusions also apply to interfaces. 类型排除也适用于接口。

If you're trying to exclude all types and interfaces, you can mark the exclusion rule as a regular expression rule, and just use .* to match all names. 如果您尝试排除所有类型和接口,则可以将排除规则标记为正则表达式规则,并使用.*匹配所有名称。 If you're trying to exclude just a subset of types, be careful to specify fully qualified names. 如果您尝试仅排除类型的子集,请注意指定完全限定名称。

You can use the Preview button to see what will be excluded. 您可以使用“预览”按钮查看将被排除的内容。 (Note that the constructors won't show as being excluded, but they will actually be excluded when you build.) (请注意,构造函数不会显示为被排除,但在构建时实际上会排除它们。)

Finally, the Pro documentation for excluding by Type has more detail about how some of these features work, so it might help to look there, too. 最后, 按类型排除Pro文档提供了有关其中某些功能如何工作的更多详细信息,因此也可能有助于查看。 For the most part, the feature is the same between Pro and Community. 在大多数情况下,Pro和社区之间的功能是相同的。

Full disclosure: I work for PreEmptive Solutions. 完全披露:我为PreEmptive Solutions工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM