我目前在使用 Visual Studio 2015 构建通用 Windows 应用程序时遇到问题。每当我尝试编译我的项目时,都会收到以下错误:
Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.
只要应用程序中存在 XAML 文件,就会发生此错误。文件包含什么并不重要。单个空 XAML 文件的构建操作设置为Page
orApplicationDefinition
足以使此错误出现。
进一步查看诊断日志,似乎错误发生在CompileXaml
任务中,但有以下异常:
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.Windows.UI.Xaml.Build.Tasks.NativeMethods.WriteWithCheckSum(IStream[] xamlStreams, Int32 numFiles, String[] pbChecksum, Int32 checksumSize, IXbfMetadataProvider provider, TargetOSVersion targetVersion, UInt32 xbfGenerationFlags, IStream[] xbfStreams, Int32& errorCode, Int32& errorFileIndex, Int32& errorLine, Int32& errorColumn)
at Microsoft.Xaml.XBF.XbfGenerator.GenerateXbfFromStreams(IStream[] inputStreams, IStream[] outputStreams, UInt32 xbfGenerationFlags, String[] checksums, TargetOSVersion targetOS, Int32& errorCode, Int32& errorFile, Int32& errorLine, Int32& errorPosition)
at Microsoft.Xaml.XBF.XbfGenerator.GenerateAll(String targetPlatformVersion, UInt32 xbfGenerationFlags)
at Microsoft.Xaml.XBF.XbfGenerator.GenerateXbfFiles(String targetPlatformVersion, UInt32 xbfGenerationFlags, Boolean v80Compat)
at Microsoft.Windows.UI.Xaml.Build.Tasks.CompileXamlInternal.GenerateXbfFiles(List`1 xamlList)
at Microsoft.Windows.UI.Xaml.Build.Tasks.CompileXamlInternal.DoExecute()
at Microsoft.Windows.UI.Xaml.Build.Tasks.CompileXaml.Execute()
此异常的原因可能是什么?
已采取但无济于事的故障排除步骤:
- 重启电脑
- 重新安装 Visual Studio 和 .NET 框架
- 从命令行构建
- 以管理员身份启动 VS(或命令行)