Code run from IDE or from .exe ?

M

Marty

Hi,

Is it possible to detect from the C# code that its main thread is run
from the VS IDE or directly from the .exe file (in debug or release) ?

This is because I want my Console output to be displayed only when the
code is run from the IDE, otherwise it go to a text file. Also, I have
another process that catch all my console output and my own console
output are noise for that process, this is why I want to detect if the
program is run from the IDE or not.

Thanks
Marty
 
S

Stoitcho Goutsev \(100\)

Marty,

I don't know if you can detect that in your code, but I think the simpler
the better. Just use a special command line key and set the VS to pass this
key when it runs the application. It the application you just check for this
key and do whatever you want to do. When you run it from the exe you don't
specify the key. This is as simple as it gets
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top