如何在后台运行.NET控制台应用程序 [英] How to run a .Net Console App in the background

查看:543
本文介绍了如何在后台运行.NET控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有控制台应用程序写在计划运行,每15分钟C#。左右使用内置的Windows任务计划程序。
每次运行黑色储物箱为它的执行期间弹出,然后关闭。
我不写任何东西到控制台。有没有办法让这个在后台运行?

I have Console Application written in C# that is scheduled to run every 15 min. or so using the Built in Windows Task Scheduler. Every time it runs the black console box pops up for the duration of it's execution and then closes. I am not writing anything to the console. Is there a way to make this run in the background?

推荐答案

轻松!

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

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

这篇关于如何在后台运行.NET控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆