How to resolve this System.IO.FileNotFoundException

前端 未结 4 640
再見小時候
再見小時候 2020-12-17 19:34
  • The error only happens in production (not in debugging).
  • The error only happens on the first application run after Windows login.
  • The error occurs w
4条回答
  •  难免孤独
    2020-12-17 19:59

    I came across a similar situation after publishing a ClickOnce application, and one of my colleagues on a different domain reported that it fails to launch.

    To find out what was going on, I added a try catch statement inside the MainWindow method as @BradleyDotNET mentioned in one comment on the original post, and then published again.

    public MainWindow()
    {
        try
        {
            InitializeComponent();
        }
        catch (Exception exc)
        {
            MessageBox.Show(exc.ToString());
        }
    }
    

    Then my colleague reported to me the exception detail, and it was a missing reference of a third party framework dll file.

    Added the reference and problem solved.

提交回复
热议问题