【问题标题】:System.IO.FileNotFoundException. Where do I find what path is wrong?System.IO.FileNotFoundException。我在哪里可以找到错误的路径?
【发布时间】:2014-02-07 11:50:46
【问题描述】:

我在 VisualStudio2010 中创建小型 Windows 窗体程序,只是出于爱好。发布它们后,我使用 .exe 文件在其他 PC 上运行它们,而无需 进行任何安装。这些 PC 运行 Windows 操作系统(7、vista、XP)。我编写代码的 PC 有 Win XP 并且 progs 可以随时正常工作。

现在我在另一台运行 Win 8.1 的 PC 上编写了另一个 prog,每当我尝试在其他平台上运行已发布的 .exe 时,都会收到以下错误,如上所述。

问题签名:
  问题事件名称:CLR20r3
  问题签名 01:dmg_ors.exe
  问题签名 02:1.0.0.0
  问题签名 03:52f4bad1
  问题签名 04:DMG_ORS
  问题签名 05:1.0.0.0
  问题签名 06:52f4bad1
  问题签名 07: 3
  问题签名 08:c
  问题签名 09:System.IO.FileNotFoundException
  操作系统版本:6.1.7601.2.1.0.256.48
  区域设置 ID:1033
  附加信息 1:82e2
  附加信息 2:82e23b36efe975bd0e9417ff09fe7bb
  附加信息 3:a1d6
  附加信息 4:a1d6e932d2c942475edff9f8fe05b46c

在线阅读我们的隐私声明:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

如果在线隐私声明不可用,请离线阅读我们的隐私声明:
  C:\Windows\system32\en-US\erofflps.tx

如何找到丢失的文件? tyvm

【问题讨论】:

  • 问题已解决,但我无法编辑问题...

标签: filenotfoundexception


【解决方案1】:
问题解决了。我不得不修改我的 main,IOT 来捕捉那个异常,看看是什么
实际上失踪了。

 static void Main()

{

 Application.EnableVisualStyles();
 Application.SetCompatibleTextRenderingDefault(false);
 Application.ThreadException += new  

ThreadExceptionEventHandler(Application_ThreadException);
      AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

  Application.Run(new Form1());

}

static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
  MessageBox.Show(e.Exception.Message, "Unhandled Thread Exception");
  // here you can log the exception ...
}

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
  MessageBox.Show((e.ExceptionObject as Exception).Message, "Unhandled UI Exception");


     // here you can log the exception 

}

然后我可以看到问题存在,因为需要安装 Visual Basic Powerpack。我假设没有安装 VS2010 的机器,即使他们有 .NET 4.5,也没有。问题是,这次有什么不同,需要这个包 IOT 运行应用程序.... 解决方案实际上是在这里找到的,我需要说一下。 http://www.csharp-examples.net/catching-unhandled-exceptions/

【讨论】:

    猜你喜欢
    • 2020-03-21
    • 1970-01-01
    • 2020-03-20
    • 2021-09-20
    • 1970-01-01
    • 2021-10-22
    • 1970-01-01
    • 2019-02-05
    • 1970-01-01
    相关资源
    最近更新 更多