C#windows应用程序事件:应用程序启动时CLR20r3

时间:2012-02-11 22:44:05

标签: c# .net file-not-found

好的,所以我创建了一个c#应用程序并将其安装在我的测试盒上。我的应用程序在我的开发盒上工作得很好,但是当我安装在另一台机器上时,它会在Main()中崩溃。我得到了EventType:CLR20r3

这是事件消息

    Problem signature:
    Problem Event Name: CLR20r3
    Problem Signature 01:   logfileviewer.exe
    Problem Signature 02:   1.0.0.0
    Problem Signature 03:   4f356c9c
    Problem Signature 04:   LogFileViewer
    Problem Signature 05:   1.0.0.0
    Problem Signature 06:   4f356c9c
    Problem Signature 07:   94
    Problem Signature 08:   44
    Problem Signature 09:   System.IO.FileNotFoundException
    OS Version: 6.1.7601.2.1.0.256.1
    Locale ID:  1033
    Additional Information 1:   0a9e
    Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
    Additional Information 3:   0a9e
    Additional Information 4:   0a9e372d3b4ad19135b953a78882e789

我使用了详细信息,并在IL反汇编程序中查找了错误代码,并使用以下内容进行回调...

    Method #5 (06000094) 
    -------------------------------------------------------
    MethodName: .ctor (06000094)
    Flags : [Public] [HideBySig] [ReuseSlot] [SpecialName] [RTSpecialName] [.ctor] (00001886)
    RVA : 0x000081d0
    ImplFlags : [IL] [Managed] (00000000)
    CallCnvntn: [DEFAULT]
    hasThis 
    ReturnType: Void
    No arguments.

.NET 4.0已卸载并重新安装在系统上,并未进行任何更改。我在网上搜索过,遇到同样问题的每个人似乎都找不到解决办法。我现在花了一天半的时间来解决这个问题。我不想错过我的截止日期,因为无法启动应用程序。

这是我的Main()

中唯一的代码
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new frmMain());
    }

以下是事件查看器的详细信息

    Application: LogFileViewer.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.IO.FileNotFoundException
    Stack:
        at LogFileViewer.frmMain.InitializeComponent()
        at LogFileViewer.frmMain..ctor()
        at LogFileViewer.Program.Main()

EVENTDATA

    Application: LogFileViewer.exe 
    Framework Version: v4.0.30319 
    Description: The process was terminated due to an unhandled exception. 
    Exception Info: System.IO.FileNotFoundException 
    Stack: at LogFileViewer.frmMain.InitializeComponent() at LogFileViewer.frmMain..ctor() at LogFileViewer.Program.Main() 

不确定设计人员如何获得FileNotFound异常。我正在使用DotNetBar.dll,我从安装目录中引用它,所以这应该是好的。如果你愿意,我可以发布我的设计师,但那里有很多。 有人有什么想法吗?

5 个答案:

答案 0 :(得分:21)

当我的应用程序依赖于部署计算机上不存在的引用程序集时,我看到了同样的问题。我不确定你的意思是“从安装目录中引用DotNetBar” - 确保它在你的项目中设置为CopyLocal=true,或者在开发和生产机器上的相同完整路径上存在。

答案 1 :(得分:3)

当我在以前在XP机器上维护的Windows 7盒子上构建应用程序时遇到了同样的问题。

为Debug构建时程序运行正常,但在为Release构建时出现此错误失败。我在项目的“属性”页面上找到了答案。转到" Build"选项卡并尝试从"任何CPU"更改平台目标到" x86"。

答案 2 :(得分:3)

.NET有两个CLR 2.0和4.0。 CLR 2.0适用于.NET framework 3.5。 CLR 4.0从.NET 4.0开始运行。您的解决方案可能使用与参考程序集不同的CLR。在本地开发环境中,您可能同时拥有两个CLR,因此您没有遇到任何问题。但是,当您迁移到部署环境时,它们可能只有一个CLR,并且您收到此错误。

答案 3 :(得分:0)

整个上午一直在打这个,现在已经解决了,为什么会这样。发布希望它有助于其他人

我安装了Krypton.Toolkit,它自动将工具添加到Visual Studio工具箱中。然后我将这些工具添加到设计器中,它自动将dll添加到projrect引用中,但是工具包被标记为CopyLocal = false

我使用release build文件夹中的所有dll构建了一个安装程序(当然上面的dll还没有)。

设置copylocal = true,然后重建安装程序,一切正常。

答案 4 :(得分:-4)

解决CLR20r3问题集 - Local User Policy \ Computer Configuration \ Windows Settings \ Security Settings \ Local Policies \ Security Options - System cryptography:使用符合FIPS 140标准的加密算法,包括加密,散列和签名 - 禁用