【问题标题】:Universal Windows Platform/UAP: what is AOT?通用 Windows 平台/UAP:什么是 AOT?
【发布时间】:2017-06-19 21:25:54
【问题描述】:

我最近在 Visual Studio 2015 中创建了一个空白 UWP 应用程序,然后尝试向该应用程序添加一个 nuget 包。软件包安装失败并导致输出窗口中出现以下消息...

System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot.
One or more packages are incompatible with UAP,Version=v10.0 (win10-arm-aot).
System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot.
One or more packages are incompatible with UAP,Version=v10.0 (win10-x64-aot).
System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot.
One or more packages are incompatible with UAP,Version=v10.0 (win10-x86-aot).

环顾四周,我在“project.json”中找到了对“运行时”的引用; (我的看起来像这样)...

{
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

我的问题是:每个“运行时”与附加“-aot”的等效运行时有什么区别?

我看到一些帖子表明,如果我想使用不支持它们的 nuget 包,我可以删除这些运行时,但我宁愿只删除它们知道它们是什么。

注意:我不知道这是否有任何区别,但我正在构建的 UWP 应用程序预计只会被侧面加载(它是一个业务线应用程序)。然而,它最终可能需要通过 Windows Business Store 分发,以简化更新等。

谢谢。

【问题讨论】:

  • 意思是“提前”。与“及时”相反。描述程序集中的中间代码编译为机器代码的方式。 UWP 中的 AOT 编译器更广为人知的是 .NET Native。是的,与 Reflection.Emit 完全不兼容,因为它总是需要即时编译器。你不能在 UWP 应用中使用它。
  • @Martin Robins,这个问题有什么更新吗?你能从下面的答案中得到有用的信息吗?
  • 你是不是通过修改project.json文件解决了这个问题?

标签: windows visual-studio-2015 uwp nuget nuget-package


【解决方案1】:

运行时是一个通用术语,指代运行您的代码的任何库、框架或平台。 win10-arm 和 win10-arm-aot 运行时是不同的平台。这是一个维基百科:Runtime system。 此外,根据维基百科Ahead-of-time (AOT)

提前 (AOT) 编译是编译高级别的行为 编程语言,例如 C 或 C++,或中间语言 例如 Java 字节码或 .NET 通用中间语言 (CIL) 代码, 转换为本机(系统相关)机器代码,目的是 本机执行生成的二进制文件。 一些具有托管代码运行时的编程语言可以编译为中间语言,利用即时 (JIT)

所以我同意 Hans Passant,AOT 编译器与 System.Reflection.Emit.ILGeneration 包不兼容。所以如果你想使用这个包,你可以删除这些aot运行时。

【讨论】:

    【解决方案2】:

    我找到了我的案例的解决方案。我的解决方案中有几个项目,所有项目都在使用

    Microsoft.NETCore.UniversalWindowsPlatform V 5.2.3

    除了一个项目。它正在使用

    Microsoft.NETCore.UniversalWindowsPlatform V 5.0.0

    当我将 5.0.0 更新到 5.2.3 时,所有错误都消失了。

    注意:您不需要从 JSON 文件中删除 aot 标签。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-15
      • 2019-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 2016-11-06
      相关资源
      最近更新 更多