【问题标题】:Exe created in VS2012 usng InstallShield not working在 VS2012 中使用 InstallShield 创建的 Exe 不起作用
【发布时间】:2016-12-06 12:37:17
【问题描述】:


我已经这样做了 100 次,但这次它不起作用。我使用 InstallShield Limited Edition Project 构建了设置,我在我的 PC 上安装了那个 msi,它工作正常。但是当我在客户端 PC 上安装它时,它会生成一个快捷方式图标,当我单击打开时,它似乎试图打开但它没有。我也禁用了防病毒,防火墙,但没有用。 这也是我正在尝试创建新 WINFORM 的新 PC。于是安装了flexera installSheild。

我根据@rabban 查看了 EventViewer 的日志。它在 .NET 运行时出现错误 日志说:

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

还有另一个错误来源:应用程序错误和日志:

Faulting application name: Banquet.exe, version: 1.0.0.0, time stamp: 0x5846b76f
Faulting module name: KERNELBASE.dll, version: 6.2.9200.17366, time stamp: 0x554d16f6
Exception code: 0xe0434352 
Fault offset: 0x00010192
Faulting process id: 0x10a8
Faulting application start time: 0x01d25048c6a7898f
Faulting application path: C:\Program Files (x86)\KAEM\My Product Name\Banquet.exe
Faulting module path: C:\WINDOWS\SYSTEM32\KERNELBASE.dll
Report Id: 048f9002-bc3c-11e6-be95-10604b723b92
Faulting package full name: 
Faulting package-relative application ID: 

【问题讨论】:

  • 您是否尝试执行应用程序本身?你查看过事件日志吗?
  • 是的,我也直接运行了 exe,但是一样。我在哪里可以找到事件日志?
  • 我可以打开 EventViewer ,我应该在哪里寻找什么?
  • 尝试启动您的应用程序并查看启动应用程序时是否有带有时间戳的事件。错误以红色图标显示。您应该查看应用程序事件,但相关事件可能在其他类别中。看看他们所有人。如果您发现一些合适的事件,请尝试自行修复或将其发布在您最初的问题中。

标签: c# visual-studio-2012 installshield


【解决方案1】:

您似乎试图访问不存在的东西。围绕表单的初始化在 program.cs 中放置一个 try/catch 并将所有内部异常和堆栈跟踪写入文本文件中的异常,然后您就知道缺少什么了。

static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        try
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
        catch (Exception exception)
        {
            // the file will be written in your execution path.
            string path = "error.txt";

            // if you don't have the rights to write in the execution path, uncomment this line and comment the other path line.
            // the file will then be located at: C:\Users\YourUserName\AppData\Local\error.txt
            //string path = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\error.txt";
            if (File.Exists(path))
                File.Delete(path);

            var sb = new StringBuilder();
            while (exception != null)
            {
                sb.AppendLine(exception.ToString());
                sb.AppendLine(exception.Message);
                sb.AppendLine();

                exception = exception.InnerException;
            }

            File.WriteAllText(path, sb.ToString());

            throw;
        }
    }
}

【讨论】:

  • 我做到了,它在string path = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\error.txt"; 上出现错误,所以将其更改为string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); 但这并没有在该文件夹中创建任何error.txt
  • 删除文件名后,无法创建文件。您可以使用“C:\temp\error.txt”交换路径,但需要确保“C:\temp\”存在。
  • 我尝试在消息框上获取异常,这就是我得到的" Could not load file or assembly 'Micosoft.VisualBasic.Powerpacks.Vs, Version=10.0.0.0, Culture=nuetral, PublicKey Token=b03f5f7f11d50a3a' or one of its dependencies. System cannot find file specified.
猜你喜欢
  • 1970-01-01
  • 2015-02-01
  • 1970-01-01
  • 2013-07-03
  • 2014-03-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多