【发布时间】:2011-11-03 14:34:45
【问题描述】:
在 XPSP3 主机上成功运行使用 Visual Basic 2008 Express Edition 编写的应用程序后,我将 EXE 文件复制到了新的 Windows 7 主机......它崩溃了,没有太多信息:
说明: 停止工作
问题签名:
问题事件名称:CLR20r3
问题签名 01:myapp.exe
问题签名 02:1.0.0.0
问题签名 03:4eb2a385
问题签名 04:myapp
问题签名 05:1.0.0.0
问题签名 06:4eb2a385
问题签名 07:f
问题签名 08:c6
问题签名 09:System.InvalidOperationException
操作系统版本:6.1.7600.2.0.0.256.1
区域 ID:1033
我可以采取哪些步骤来调查为什么 VB.NET 应用程序不能在不同的主机上运行?
这是由于缺少依赖项。要捕获此类错误,请将以下内容添加到 Form1:
Public Sub New()
AddHandler Application.ThreadException, AddressOf OnThreadException
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf UnhandledExceptionEventRaised
InitializeComponent()
End Sub
Private Sub UnhandledExceptionEventRaised(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
If e.IsTerminating Then
Dim o As Object = e.ExceptionObject
MessageBox.Show(o.ToString) ' use EventLog instead
End If
End Sub
Private Sub OnThreadException(ByVal sender As Object, _
ByVal e As ThreadExceptionEventArgs)
' This is where you handle the exception
MessageBox.Show(e.Exception.Message)
End Sub
【问题讨论】:
-
您是否部署了带有可执行文件的 .PDB?
-
我的第一步是确保新主机支持用于创建应用程序的框架(例如,您需要 .NET 4,但主机只有 2.0?)
-
感谢您的提示。我添加了 PDB 文件,并且 Windows7 安装了 .Net 4,但我得到了同样的错误。
-
根据 ILSpy (wiki.sharpdevelop.net),它需要 .Net framework 2.0 ... Windows7 说在我运行 dotnetfx.exe 时已经安装了
标签: vb.net