【问题标题】:Deploying a debug version of a vb.net app部署 vb.net 应用程序的调试版本
【发布时间】:2011-02-01 23:01:37
【问题描述】:

我在 vb.net 中开发了一个应用程序。我在我的解决方案中使用我作为不同项目的一部分构建的 dll。出于某种原因,我无法使用构建为“发布”版本的 dll 获得应用程序的全部功能,但如果将 dll 构建为“调试”版本(这是一个完全不同的问题),它确实可以工作。我现在没有问题,使用调试版本。但是,我遇到的问题是我正在尝试将应用程序部署到另一个系统,如果我部署 dll 的调试版本,我会收到运行时错误(见下文)。我安装了 .net 框架。我只是想知道必须安装什么才能让我使用新系统的调试版本?

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at tocapp.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\gregh\My Documents\Visual Studio 2005\Projects\TOCApp2\TOCApp2\Form1.vb:line 104
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.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.3607 (GDR.050727-3600)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
tocapp
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/Sparnet/tocapp.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.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.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.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
SparnetMapControl
    Assembly Version: 0.0.0.0
    Win32 Version: 0.0.0.0
    CodeBase: file:///C:/Program%20Files/Sparnet/SparnetMapControl.DLL
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Oracle.DataAccess
    Assembly Version: 10.2.0.100
    Win32 Version: 10.2.0.100
    CodeBase: file:///C:/WINDOWS/assembly/GAC/Oracle.DataAccess/10.2.0.100__89b483f429c47342/Oracle.DataAccess.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.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:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

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.

【问题讨论】:

  • 我在传递 APP 或 DLL 的调试版本时没有遇到问题。 “调试”主要是指添加“额外”的项目,而不是必需操作。上面的错误看起来更像真实的东西。让我们看看您的 VB 代码在该行号周围是什么样子。
  • 这是从 VS2008 构建的吗?如果是这样,您的目标是哪个框架,2.0、3.0 还是 3.5?如果后两者中的任何一个都安装在另一台机器上?此外,您的问题可能不是远程机器不会运行您的调试版本,而是调试版本是唯一的工作版本,它只能在您的机器上运行。我会先解决调试/发布问题。否则,当你真的手臂骨折时,你可能会通过拜访教练来解决“我的网球技术不好”的问题。
  • 我正在运行 VS 2008。当我尝试通过调用已开发的 dll 中提供的功能打开文件时,似乎发生了错误。顺便说一句,我的目标是 2.0 框架,并在两台机器上都安装了它。
  • 所以这是一个有趣的更新,因为我正在尝试解决为什么我的应用程序与底层 dll 的调试版本一起工作而不能与使用的底层 dll 的发布版本一起工作的问题.如果我更改调试版本的一个配置项并使用生成的 dll,那么该功能将不起作用。如果我把它改回来,它确实有效。因此,如果我更改:“配置属性”=>“C/C++”=>“代码生成”=>“运行时库从“多线程调试 DLL (/MDd)”到“多线程 DLL (/MD) " 那么我正在寻找的功能不再有效。

标签: vb.net visual-studio visual-studio-2008 deployment


【解决方案1】:

看起来您的“底层 dll”可能有一个错误,一旦您进行调试构建,该错误就会消失;造成这种情况的潜在原因有很多,从线程同步问题(当 DebugWrite() 调用从发布版本中删除时消失)一直到内存启动不当造成的内存损坏。

【讨论】:

    【解决方案2】:

    “如果我更改:“配置属性”=>“C/C++”=>“代码生成”=>“运行时库从“多线程调试 DLL (/MDd)”到“多线程 DLL (/ MD)"那么我正在寻找的功能不再有效"

    我知道这是一个很小的旧帖子,但可能对某人有用。

    这看起来像是链接问题在其他任何事情之前。 您不能将调试库与不包含调试的项目混合使用,并确保两个依赖库具有相同的构建类型。 库和项目都必须具有相同的建筑属性: 调试/多线程项目必须与调试/多线程库链接, 并且发布/多线程项目必须与发布/多线程库链接。

    确保项目属性中是这种情况。

    您也不能部署调试版本的 c++ 项目,因为它必须发布。这是因为目标操作系统始终具有 c++ 运行时库的发布版本;) c++ dll 的调试版本仅安装在 VS 中,或者可能也安装在其他一些开发环境中。

    还要注意 c++ 是特定于 c++ 运行时库的,没有特定清单文件的应用程序,在大多数情况下,您已经指定了 c++ 运行时库版本的范围,明确地针对您构建应用程序的 c++ 运行时库版本。因此,请确保部署与您的应用程序相同版本的可再发行 C++ 运行时库(现在它通常在 3mb 左右,没什么大问题)。

    或静态链接所有内容(更大的应用程序,更大的内存占用,设置环境的地狱,但不需要共享的 c++ 运行时库 - 这是我喜欢 deplhi == 不依赖的主要原因)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 1970-01-01
      相关资源
      最近更新 更多