我的 Xamarin 应用程序运行正常,没有混淆。但是,在专业版和社区版中使用 DotFuscator 时,构建过程会失败:
- 使用DotFuscator 专业版:
我已经使用官方文档中提到的配置编辑了我的 android .csproj 文件
但是在构建我的android项目时,我收到了这个错误:
2> [Build Output] Reading debugging symbols for module 'NameSpace.dll'...
2> [Build Output] Skipping sequence point because its offset does not point to an instruction: method '[NameSpace.dll] NameSpace.Views.SomePage::void InitializeComponent()', offset 0x0022
2> [Build Output] Skipping sequence point because its offset does not point to an instruction: method '[NameSpace.dll] NameSpace.Views.AnotherPage::void InitializeComponent()', offset 0x0022
2> [Build Output] Skipping sequence point because its offset does not point to an instruction: method '[NameSpace.dll] NameSpace.Views.AnotherPage::void InitializeComponent()', offset 0x0033
.
.
.
2> [Build Output] Read debugging symbols for module 'NameSpace.dll'.
2> [Build Output] Warning: When reading debugging symbols for module 'NameSpace.dll', one or more sequence points were invalid and were skipped. Debugging symbols emitted for this module may be incorrect.
2> [Build Output] An item with the same key has already been added.
2> [Build Output] Build Error.
- 使用DotFuscator 社区版:
按照https://www.preemptive.com/dotfuscator/ce/docs/help/getting_started_xamarin.html上的说明进行操作
它产生这个错误
Error The command ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE\dotfuscatorCLI.exe" /p:InDir="obj\Release\100\DotfuscatorXamarin\dfin",OutDir="obj\Release\100\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\Release" "obj\Release\100\DotfuscatorXamarin\Template.dfconfig" /in:+"${configdir}\${InDir}\NameSpace.Android.dll",+"${configdir}\${InDir}\NameSpace.dll" /makeconfig:"DotfuscatorConfig.xml"" exited with code 1. NameSpace.Android D:\folder1\folder2\PreEmptive.Dotfuscator.Xamarin\PreEmptive.Dotfuscator.Xamarin.Targets 508
Error The initial run of Dotfuscator failed (exit code '1'). A new Dotfuscator config file, 'DotfuscatorConfig.xml', has been generated, but may not build correctly.
我想知道为什么会这样?什么是正确的解决方法?
注意:我已经在全新的 Xamarin 项目上尝试了这两个版本,并且都正常工作(没有错误 + 创建了 DotfuscatorReports)。