.NET Native 编译器不断抛出编译错误
.NET Native compiler keeps throwing compilation errors
几天来我一直在尝试使用 .NET Native 工具链编译我的应用程序,但我仍然无法让它正常工作。
如果我尝试在不使用 .NET Native 选项的情况下编译它(因此在调试模式下),一切正常,应用程序按预期编译和运行。
但是,每当我尝试在发布模式下编译它时,一旦 .NET Native 进程启动,我就会收到以下错误:
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : System.InvalidOperationException: Unable to generate a temporary class (result=1).
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.DependencyObject' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.Data.IValueConverter' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.Markup.IXamlMetadataProvider' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error :
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.Compiler.Compile(String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence, String outputDir, String intermediateDir, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Hashtable assemblies, String outputDir, String intermediateDir, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, XmlMapping[] mappings, CompilerParameters parameters, String outputDir, String intermediateDir, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, String outputDir, String intermediateDir, List`1 wcfSerializers, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in SerializationAssemblyGenerator.Program.Main(String[] args)
我试图在 Google 上找到一些东西,但没有结果。
我真的不知道是我做错了什么,还是我可以做些什么来解决这个问题。正如我所说,当我在调试模式下编译项目时,没有 .NET Native,一切都很好。
感谢您的帮助!
这很可能是由于您的应用程序或一组库中的 *.rd.xml 文件过于包容所致。寻找 XmlSerialize 的过度广泛用途,例如:
最有可能的是,您实际上不需要序列化 MyAssembly 中的所有内容,并且这些类型的广泛包含使得序列化生成器更有可能出现阻塞和崩溃。
几天来我一直在尝试使用 .NET Native 工具链编译我的应用程序,但我仍然无法让它正常工作。
如果我尝试在不使用 .NET Native 选项的情况下编译它(因此在调试模式下),一切正常,应用程序按预期编译和运行。
但是,每当我尝试在发布模式下编译它时,一旦 .NET Native 进程启动,我就会收到以下错误:
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : System.InvalidOperationException: Unable to generate a temporary class (result=1).
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.DependencyObject' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.Data.IValueConverter' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.Markup.IXamlMetadataProvider' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error :
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.Compiler.Compile(String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence, String outputDir, String intermediateDir, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Hashtable assemblies, String outputDir, String intermediateDir, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, XmlMapping[] mappings, CompilerParameters parameters, String outputDir, String intermediateDir, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, String outputDir, String intermediateDir, List`1 wcfSerializers, Boolean loadAssembly)
1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in SerializationAssemblyGenerator.Program.Main(String[] args)
我试图在 Google 上找到一些东西,但没有结果。
我真的不知道是我做错了什么,还是我可以做些什么来解决这个问题。正如我所说,当我在调试模式下编译项目时,没有 .NET Native,一切都很好。
感谢您的帮助!
这很可能是由于您的应用程序或一组库中的 *.rd.xml 文件过于包容所致。寻找 XmlSerialize 的过度广泛用途,例如:
最有可能的是,您实际上不需要序列化 MyAssembly 中的所有内容,并且这些类型的广泛包含使得序列化生成器更有可能出现阻塞和崩溃。