如何使用本机Corert预览构建



我试图使用Corert ILC编译器和Microsoft Linker构建一个.net Core 2.0控制台应用程序。

到目前为止,我下载了Corert库的最新版本,并成功地使用发行目标构建了预览,如COMPOR C7781A90F006BD06BD06BD06EF57E5D3FD3FD879FE3E9A0。

我添加了构建脚本rd.xml,ilc.rsp和link.rsp,但我一直从ILC获取消息:

Error: Target architecture is not supported
Internal.CommandLine.CommandLineException: Target architecture is not supported
   at ILCompiler.Program.Run(String[] args)
   at ILCompiler.Program.Main(String[] args)

更新:我能够用架构解决问题,但是现在它失败了,缺少文件参考:

C:testapp>call "..corertbinWindows_NT.x64.Releasetoolsilc.exe" ".ilc.rsp"
Error: [TEMPORARY EXCEPTION MESSAGE] FileLoadErrorGeneric: Microsoft.Extensions.Options
Internal.TypeSystem.TypeSystemException+FileNotFoundException: [TEMPORARY EXCEPTION MESSAGE] FileLoadErrorGeneric: Microsoft.Extensions.Options
   at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID id, String fileName)
   at ILCompiler.CompilerTypeSystemContext.GetModuleForSimpleName(String simpleName, Boolean throwIfNotFound)
   at Internal.TypeSystem.CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(ModuleDesc module, String name, Boolean throwIfNotFound, Func`4 resolver)
   at Internal.TypeSystem.CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(ModuleDesc module, String name, Boolean throwIfNotFound, Func`4 resolver)
   at ILCompiler.RdXmlRootProvider.ProcessTypeDirective(IRootingServiceProvider rootProvider, ModuleDesc containingModule, XElement typeElement)
   at ILCompiler.RdXmlRootProvider.ProcessAssemblyDirective(IRootingServiceProvider rootProvider, XElement assemblyElement)
   at ILCompiler.RdXmlRootProvider.AddCompilationRoots(IRootingServiceProvider rootProvider)
   at ILCompiler.Compilation..ctor(DependencyAnalyzerBase`1 dependencyGraph, NodeFactory nodeFactory, IEnumerable`1 compilationRoots, DebugInformationProvider debugInformationProvider, Logger logger)
   at ILCompiler.ILScannerBuilder.ToILScanner()
   at ILCompiler.Program.Run(String[] args)
   at ILCompiler.Program.Main(String[] args)

更新2:我能够通过查找所有丢失的文件来解决问题,但是最后我意识到我需要将体系结构目标切换到x64,但是现在它失败了链接器:

C:testapp>call link @".link.rsp"
libcpmt.lib(nothrow.obj) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

问题是由使用开发者命令提示而不是x64本机工具命令提示符引起的。前者默认为X86,但后一个针对X64,并将与X64库链接。

最新更新