0

I need to run a .net application c# or preferably VB that will just perform a given task then close itself.

This app will receive arguments from the command line, process calculations, write result text to a file and then end.

Currently I run it as a console app, therefore the user can see the console black window and then the windoiw vanishes.

How can I get rid of the visual element?

Also, once the project is compiled, how can I include it within another solution so that both projects will be published together with clickOnce?

I need two separate projects in the same solution because one of them (the silent one) must run in x86 mode and the other as x64.

Ken White
  • 123,280
  • 14
  • 225
  • 444
user3553401
  • 109
  • 2
  • 15

2 Answers2

2

Assuming you're using a recent version of Visual Studio, go into your project properties (Application tab) and change the "Output type" dropdown from Console Application to Windows Application.

Not sure about the click-once requirement, though... haven't been down that road, but it may warrant a separate question.

Mark Waterman
  • 961
  • 7
  • 16
  • 2
    Reasonable option if application does not take long time to run (seconds), otherwise I think Windows may get uneasy about lack of window/message processing. – Alexei Levenkov Mar 14 '15 at 01:14
1

Run the app as a process and set the window style to hidden.

System.Diagnostics.ProcessStartInfo start = new System.Diagnostics.ProcessStartInfo();     
start.FileName = dir + @"\silentApp.exe";
start.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

https://msdn.microsoft.com/en-us/library/system.diagnostics.process.start%28v=vs.110%29.aspx