我的 Windows 窗体应用程序(使用 C# 在 Visual Studio 2008 中创建)分布在我们公司内,可在 50 多台 PC 上运行,没有任何问题。
昨天,我不得不在一台运行 WinXP 的旧 PC 上安装它。我的 Visual Studio 2008 安装项目提示安装 .Net Framework 3.5 SP1。我们安装了它,重新启动,然后继续安装。
安装后,我关闭了旧机器,等待了大约 5 秒钟,然后重新打开。
当我尝试运行应用程序时,我得到了未处理的异常:“无法从程序集 'mscorlib 加载类型 'System.DateTimeOffset',版本 = 2.0.0.0,文化 = 中性,PublicKeyToken = b77a5 ... 等等,等等,等等.
为什么 3.5 SP1 没有安装该
DateTimeOffset
功能?为什么应用程序试图从中加载它
mscorlib version 2.0
?我搜索了关键字
DateTimeOffset
,但它在我的项目中的任何地方都不存在。这是DateTime
(即DateTime.Now.AddDays(1)
)的一部分吗?
这是完整异常的副本:
有关调用的详细信息,请参阅此消息的末尾 即时 (JIT) 调试,而不是此对话框。 ************** 异常文本 ************** System.TypeLoadException:无法从程序集“mscorlib,版本=2.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089”加载类型“System.DateTimeOffset”。 在 System.ComponentModel.ReflectTypeDescriptionProvider.get_IntrinsicTypeConverters() 在 System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetConverter(对象实例) 在 System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetConverter() 在 System.ComponentModel.TypeDescriptor.GetConverter(类型类型) 在 System.Windows.Forms.ListControl.GetItemText(对象项) 在 System.Windows.Forms.ComboBox.NativeAdd(对象项) 在 System.Windows.Forms.ComboBox.OnHandleCreated (EventArgs e) 在 System.Windows.Forms.Control.WmCreate(消息和 m) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 System.Windows.Forms.ComboBox.WndProc(消息和 m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam) ************** 加载的程序集 ************** mscorlib 程序集版本:2.0.0.0 Win32 版本:2.0.50727.42 (RTM.050727-4200) 代码库:file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll -------------------------------------- 套房 程序集版本:2.2.21.30536 Win32版本:2.2.21 代码库:file:///C:/Program%20Files/Aaon%20Coil%20Products,%20Inc/ACP%20Software%20Suite/Suite.exe -------------------------------------- System.Windows.Forms 程序集版本:2.0.0.0 Win32 版本:2.0.50727.3053 (netfxsp.050727-3000) 代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll -------------------------------------- 系统 程序集版本:2.0.0.0 Win32 版本:2.0.50727.3053 (netfxsp.050727-3000) 代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll -------------------------------------- 系统绘图 程序集版本:2.0.0.0 Win32 版本:2.0.50727.42 (RTM.050727-4200) 代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll -------------------------------------- 系统核心 程序集版本:3.5.0.0 Win32 版本:3.5.30729.1 构建者:SP 代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll -------------------------------------- 可访问性 程序集版本:2.0.0.0 Win32 版本:2.0.50727.3053 (netfxsp.050727-3000) 代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll -------------------------------------- 系统数据 程序集版本:2.0.0.0 Win32 版本:2.0.50727.42 (RTM.050727-4200) 代码库:file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll -------------------------------------- AcpFormHeader 程序集版本:1.0.5.0 Win32版本:1.0.5 代码库:file:///C:/Program%20Files/Aaon%20Coil%20Products,%20Inc/ACP%20Software%20Suite/AcpFormHeader.DLL -------------------------------------- 系统文件 程序集版本:2.0.0.0 Win32 版本:2.0.50727.42 (RTM.050727-4200) 代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll -------------------------------------- ************** JIT 调试 ************** 要启用即时 (JIT) 调试,为此的 .config 文件 应用程序或计算机 (machine.config) 必须具有 在 system.windows.forms 部分设置的 jitDebugging 值。 应用程序还必须通过调试进行编译 启用。 例如: 启用 JIT 调试后,任何未处理的异常 将发送到计算机上注册的 JIT 调试器 而不是由该对话框处理。