我的Windows表单应用程序(在Visual Studio 2008中使用C#创建)分布在我们的公司中,并在没有问题的50多个PC上运行。

昨天,我必须将其安装在运行WinXP的旧PC上。我的Visual Studio 2008设置项目提示安装.NET Framework 3.5 SP1。我们安装了它,重新启动,然后继续安装。

安装后,我关闭了旧机器,等待大约5秒钟,然后重新打开。

当我尝试运行该应用程序时,我得到了未经治疗的例外: “无法加载类型'system.datetimeOffset'来自汇编'mscorlib,版本= 2.0.0.0,culture =中性,publickeytoken = b77a5... 等等等等等等。

Screen Shot of error

  1. 为什么3.5 SP1不安装 DateTimeOffset 特征?

  2. 为什么应用程序试图从 mscorlib version 2.0?

  3. 我搜索了关键字 DateTimeOffset, ,但它在我的项目中都不存在。这是 DateTime (IE DateTime.Now.AddDays(1))?

这是完整吹的例外的副本:

   See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.TypeLoadException: Could not load type 'System.DateTimeOffset' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.ComponentModel.ReflectTypeDescriptionProvider.get_IntrinsicTypeConverters()
   at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetConverter(Object instance)
   at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetConverter()
   at System.ComponentModel.TypeDescriptor.GetConverter(Type type)
   at System.Windows.Forms.ListControl.GetItemText(Object item)
   at System.Windows.Forms.ComboBox.NativeAdd(Object item)
   at System.Windows.Forms.ComboBox.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ComboBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Suite
    Assembly Version: 2.2.21.30536
    Win32 Version: 2.2.21
    CodeBase: file:///C:/Program%20Files/Aaon%20Coil%20Products,%20Inc/ACP%20Software%20Suite/Suite.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.30729.1 built by: SP
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
AcpFormHeader
    Assembly Version: 1.0.5.0
    Win32 Version: 1.0.5
    CodeBase: file:///C:/Program%20Files/Aaon%20Coil%20Products,%20Inc/ACP%20Software%20Suite/AcpFormHeader.DLL
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:


    


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

有帮助吗?

解决方案

  1. 好问题。该安装似乎是故障的。
  2. 因为.NET 3.5和.NET 3.0使用2.0运行时。
  3. 不,不是。这是一个完全独立的结构(请参阅 MSDN)。必须有一些组件 使用它,可能是第三方大会。

其他提示

Win32 Version: 2.0.50727.42 (RTM.050727-4200)

安装过程中有严重错误的问题。修订42是原始.NET 2.0版本。该痕迹还显示2.0.50727.3053,这是一个很好的。目前,该机器具有组装版本的混合匹配版本。确实期望这样的例外。当然,这是如何发生的,我猜想在现有2.0安装的顶部安装不良的3.5安装。或者,您忘了安装后重新启动机器。

我今天有同样的问题。我在datavisualization.charting.series中插入值

MaSerie.Points.AddXY(x, y)

我为此更改代码,DateTimeOffset错误消失了

MaSerie.Points.Add(New DataVisualization.Charting.DataPoint(x, y))
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top