简体   繁体   English

在另一台计算机上运行我的C#exe?

[英]Running my c# exe on another computer?

I've completed a C# program which uses winforms and Microsoft.Speech (both recognition and synthesis) library, built it and it runs fine on the same computer. 我已经完成了一个使用Winforms和Microsoft.Speech(识别和综合)库的C#程序,并对其进行了构建,并且可以在同一台计算机上正常运行。 However when I copy the whole application directory to another computer the program starts and shuts down immediately. 但是,当我将整个应用程序目录复制到另一台计算机时,程序将立即启动并关闭。

Things I have tried: 我尝试过的事情:

  • Main method has a try-catch which prints all exceptions. Main方法有一个try-catch,可以打印所有异常。 I've tried running the both straight from the directory and command line, both resulting identically the program closing immediately without any exceptions thrown 我试过直接从目录和命令行运行这两个命令,两者导致程序立即关闭且没有引发任何异常
  • I've checked that the computer I'm trying to run the executable on has the correct version of .NET framework (my executable uses 4.5.2 and the computer states it already has a newer version) 我已经检查过我要在其上运行该可执行文件的计算机具有正确版本的.NET Framework(我的可执行文件使用4.5.2,并且计算机声明它已经具有较新的版本)

  • I've also downloaded the Microsoft.Speech libraries on the new computer, no effect 我还已经在新计算机上下载了Microsoft.Speech库,没有效果

Obviously I have gone wrong about the whole deployment task here. 显然,我在这里的整个部署任务出错了。 Most of the beginner guides suggest using the Setup and Deployment project template, but that is no longer supported in Visual Studio. 大多数初学者指南建议使用安装和部署项目模板,但Visual Studio不再支持该模板。 As this is a whole new area of programming to me I'm now completely lost on how to proceed. 因为这对我来说是一个全新的编程领域,所以我现在对如何继续完全迷失了。 Please help. 请帮忙。

添加一条try {}(Exception ex)catch {}语句,然后在catch语句中,将ex.toString()写入文件,以便您读取错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM