且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在后台运行.NET控制台应用程序

更新时间:2022-02-08 23:02:29

轻松!

这似乎很难相信,但可以作为一个魅力。当您希望与任何迹象执行自定义任务,我已经使用了一段安装项目。

It seems hard to believe, but works as a charm. I have used this for some setup projects, when you want to perform custom tasks with no signs of it.


  • 创建项目作为Windows应用程序项目(这是最困难的部分)。

  • 永远不会调用任何形式的,只是恰好保持在您的控制台应用程序

  • Create the project as a Windows application Project (this is the hard part).
  • Never calls to any form, just keep on in exactly as in your console application

class Program
{
    static void Main(string[] args)
    {
        // just dont Application.Run(new frmMain(args));
        //... your code
    }
 }


这是因为Windows应用程序项目比控制台没有真的不同,因为第一种形式和参考节选。
完全隐藏的执行
尝试一下!
HTH

This is because windows application projects are no really different than console, excepts because of the first form and references. Totally hidden execution Try it! HTH