views:

1687

answers:

3

In C# and .NET, I wrote an application that runs in a Form (using Windows.System.Forms). I use InnoSetup to install and I am able to start the application via Windows' Start button.

My problem: a DOS command-prompt window appears along with the Form. How can I prevent the DOS window from appearing?

+6  A: 

Sounds like you compiled the application with the wrong target--likely, you need to tell Visual Studio to compile it targeting a GUI executable, not a CLI executable.

You can do this in the project preferences.

B.R.
I don't have a project -- I'm compiling from the command-line.
JaysonFix
Aha--then you need to compile with /target:winexe. :)
B.R.
+9  A: 

Did you create the application using Visual Studio? If so, in the project properties, in the Application tab, there's a setting called "Output type". If this is set to "Console Application", a command-prompt window will appear when running the program, as well as the form. Setting it to "Windows Application" (the default for Windows Forms projects) will sort this out.

EDIT: Just saw your comment on the other answer. This setting corresponds to the "/target" switch for the compiler. /target:exe will give you the command-prompt, /target:winexe will just show the form. Hopefully anyway! I'm just going by the build output from Visual Studio.

Graham Clark
I compiled with "csc.exe /target:winexe", and that did the trick! Thank you, Partario!
JaysonFix
A: 

Hi Friends,

I got a same problem. Cmd window was opening while running the application and it got solved now. Many thanks.

regards,

Krishna N

Krishnagiri N