Visual Studio 2015退出代码0xE0434352

时间:2015-12-08 15:14:43

标签: winforms visual-studio visual-studio-2015

我有一个构建脚本,它从命令行启动Visual Studio,如下所示:

devenv.exe <project file> /Rebuild "Release" /Project <project name> /UseEnv /Out <log file>

完成后,脚本会检查Visual Studio的退出代码。

我们已经从Visual Studio 2010更新到2015年。大多数项目编译没有问题,但有些项目退出代码为0xE0434352,我认为是System.InvalidOperationException。

Windows事件日志显示两个条目:

Faulting application name: devenv.exe, version: 14.0.24720.0, time stamp: 0x564ea97e
Faulting module name: KERNELBASE.dll, version: 6.1.7601.19045, time stamp: 0x56258f05
Exception code: 0xe0434352
Fault offset: 0x0000c42d
Faulting process id: 0xb64
Faulting application start time: 0x01d131c68bdc0db0
Faulting application path: c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: cb600c61-9db9-11e5-abfc-005056c00008

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
   at System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)
   at System.Windows.Forms.Control.BeginInvoke(System.Delegate, System.Object[])
   at System.Windows.Forms.WindowsFormsSynchronizationContext.Post(System.Threading.SendOrPostCallback, System.Object)
   at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.PostAction(System.Object)
   at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(System.Threading.ContextCallback, System.Object, System.Threading.Tasks.Task ByRef)
   at System.Threading.Tasks.AwaitTaskContinuation+<>c.<ThrowAsyncIfNecessary>b__18_0(System.Object)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

这些项目是VB和C#Windows Forms项目。它不会发生在C ++项目中。

据我所知,组件总是正确构建,关闭visual studio时会发生异常。我修改了我们的脚本以忽略这个特定的错误,但这似乎不是一个很好的解决方案。

有人可以建议如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

如果这些都是您构建的正常项目,则不需要devenv来为您完成这项工作。

只需使用msbuild

我认为这个命令行应该让你开始:

msbuild /t:Build /p:Configuration=Release [your .sln or .csproj or .vbproj] 

指示msbuild处理Build目标并将名为Configuration的Property设置为Release

请注意如何以这种方式构建完整的解决方案或单个项目。唯一的例外是只为Visual Studio而不是msbuild所知的项目类型。对于安装项目类型的VS的早期版本。如果没有运行devenv,你就无法构建那个。