Visual Studio 2015 (Windows 10) 中的 .NET Native 编译失败

.NET Native compilation in Visual Studio 2015 (Windows 10) fails

我最近从 Windows 8.1 Pro 升级到 Windows 10 Pro。我还安装了 Visual Studio 2015 Professional 并卸载了 Visual Studio 2013 Professional。

每当我尝试在启用“.NET Native 工具链”的发布模式下构建 Windows 10 应用程序时,它都会失败并出现两个错误:

1. RHBIND : error RHB0007: Could not load input file 'D:\Projects\MyProject\obj\x86\Release\ilc\intermediate\MDIL\MyProject.mdilexe'.
2. ILT0005: 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\Tools\rhbind.exe @"D:\Projects\MyProject\obj\x86\Release\ilc\intermediate\rhbindargs.MyProject.rsp"' returned exit code 7

相同的 project/solution 在我同事的计算机上构建完全正常(最近也从 Windows 8.1 Pro 升级到 Windows 10 Pro Visual Studio 2015 Professional)。

我已经试过几次修复 Visual Studio 2015 的安装,现在都没有成功。

此外,似乎没有任何关于 rhbind.exe 退出代码的信息。我仔细检查了 *.mdilexe*.rsp 文件是否存在。两者肯定都是创建的,不为空...

有其他人遇到过这些问题吗?还是只有我遇到过?

编辑 我应该提一下,在 Visual Studio 中增加输出日志的详细级别不会产生有关错误的更多信息。但是,在第一个错误之后和第二个错误之前会立即出现一些警告:

4>STARTPROCESSTASK : warning : Unsupported section type '.tks0' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.
4>STARTPROCESSTASK : warning : Unsupported section type '.tks1' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.
4>STARTPROCESSTASK : warning : Unsupported section type '.tks2' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.
4>STARTPROCESSTASK : warning : Unsupported section type '.tks3' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.
4>STARTPROCESSTASK : warning : Unsupported section type '.tks4' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.
4>STARTPROCESSTASK : warning : Unsupported section type '.tks5' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.
4>STARTPROCESSTASK : warning : Unsupported section type '.tks6' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.
4>STARTPROCESSTASK : warning : Unsupported section type '.tks7' in 'C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Native\corelib.native.lib(f:\binaries\Intermediate\FxCore\x86ret\corelib.native\ThunkPoolThunks_x86.obj)', skipping the import of that section.

嗯,我通过替换文件夹解决了问题

C:\Program Files (x86)\MSBuild\Microsoft.NetNative

在我的机器上和我同事的机器上。然后我重新启动了 Visual Studio 2015,运行 一个新的构建 - 瞧 - 它起作用了!

这看起来像是 .Net Native 工具链的几个部分之间的不匹配 (ilc.exe)。特别是 nutc_driver.exe 和 rhbind.exe。也许你的机器以某种方式从早期版本的 VS 中获得了 rhbind(也许 VS RC 从 ~ 2015 年 5 月开始?)。有点遗憾,修复不了。

如果其他人遇到这种情况,了解这些工具的版本信息会很有趣。他们住在 "C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\tools".