【问题标题】:Dotfuscator failing on Xamarin UWP projectDotfuscator 在 Xamarin UWP 项目上失败
【发布时间】:2019-06-17 14:19:25
【问题描述】:

我有一个 Xamarin Forms 应用程序,已成功将 Dotfuscator CE 与 Android 和 iOS 集成。现在我正在尝试与 UWP 集成,但在 Dotfuscator 运行时出现构建错误。我打开了更详细的输出并看到了这个:

[Build Output] Couldn't load external type because its assembly can't be found: Windows.UI.Xaml.Controls.Page,Windows.Foundation.UniversalApiContract, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null

我遵循用于 Android 和 iOS 的相同指示,并更新了 Dotfuscator CE (5.40.0.8950) 和 Visual Studio Community 2017 (15.9.5)。有任何想法吗?是否无法使用 Dotfuscator CE 保护 UWP?

【问题讨论】:

    标签: xamarin uwp dotfuscator


    【解决方案1】:

    如果位置自较早的 SDK 版本发生更改,您可能需要告诉 Dotfuscator 在哪里可以找到 UniversalApiContract。我在这里找到了我的,您的路径可能会因您拥有的版本而异:

    C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.UniversalApiContract\7.0.0.0
    

    告诉 Dotfuscator 社区查看此附加目录:

    1. 通过选择 Tools > PreEmptive Protection - Dotfuscator Community,从 Visual Studio 启动 Dotfuscator Config Editor (GUI)。
    2. 为您的 UWP 项目打开 DotfuscatorConfig.xml 文件。
    3. Settings > Assembly Load Paths下,单击绿色加号图标添加路径,将路径粘贴到目录,然后单击确定。
    4. 保存配置文件。

    之后,再次尝试从 Visual Studio 构建项目。

    注意:我在 Dotfuscator 团队工作,并且作为我工作的一部分回答问题。

    【讨论】:

    • 添加它会导致以下错误:error : ILT0040: Type 'System.Runtime.Serialization.InvalidDataContract' was not found. Check that your build system references Windows.winmd, references .NET for Windows Store Apps, and is configured to use .NET Native. 我取消选中“使用 .NET Native 工具链编译”,现在它正在构建。谢谢!
    • 不幸的是,它在启动时崩溃并出现错误:Unable to activate Windows Store app...Operation not supported. Unknown error: 0x80040904 在发布版本上关闭 Dotfuscator 时我没有遇到此崩溃。
    • @cncb 您可能需要将应用程序的某些部分从 Dotfuscator 的重命名混淆中排除。具体的排除将因应用程序而异。一些资源:how to configure renaming exclusions via the Config Editor in Dotfuscator Communitysome examples of exploring/discovering renaming exclusions(为 Dotfuscator Professional 编写,但概念与 Community 相同)。
    • 我已经为我的 Xamarin Forms dll 添加了所有必要的排除项,但我不知道它的 UWP exe 部分需要什么(它在“激活”期间启动时崩溃)。似乎应该有一个明显的类或方法可以从 UWP 的重命名中排除。我试图从重命名中排除 App 和 Program 类型,但没有成功,但我不知道“激活”会涉及什么。
    • 虽然原生编译会使应用逆向工程变得困难,但 Dotfuscator 仍然会使它变得更加困难。
    猜你喜欢
    • 1970-01-01
    • 2020-01-03
    • 1970-01-01
    • 1970-01-01
    • 2016-10-13
    • 2018-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多