471,305 Members | 1,247 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 software developers and data experts.

Code run from IDE or from .exe ?

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
Jan 26 '06 #1
1 1439
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

--
HTH
Stoitcho Goutsev (100).

"Marty" <xm******@hotmail.com> wrote in message
news:Pg5Cf.148083$km.67969@edtnps89...
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

Jan 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

242 posts views Thread by James Cameron | last post: by
4 posts views Thread by jason | last post: by
109 posts views Thread by Andrew Thompson | last post: by
8 posts views Thread by Paul Cochrane | last post: by
29 posts views Thread by John Rivers | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.