By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Detect if app was started from VS

P: n/a
bz
Hi,

I need to detect at runtime if the application was started from VS
2005. Is it possible?
Also, how can I know at runtime of app is built for Debug or Release?

Thanks
Nov 17 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can tell Visual Studio to run your application with a special command
line argument. Click Project -Properties -Debug and enter "/debug" as an
argument. Use the following if-statement in your program to detect if it was
started from Visual Studio:

string[] args = Environment.GetCommandLineArgs(); // remove this line if
your program is a console application
if (args.Length 0 && args[0] == "/debug")
// started from VS
else
// not started from VS

I'm sure there are more elegant solutions but this is one of the easiest.

"bz" <bz*****@gmail.comschrieb im Newsbeitrag
news:fc**********************************@e1g2000h sh.googlegroups.com...
Hi,

I need to detect at runtime if the application was started from VS
2005. Is it possible?
Also, how can I know at runtime of app is built for Debug or Release?

Thanks
Nov 18 '07 #2

P: n/a
bz
On 18 Noi, 10:35, "Christoph Hausner" <christoph_haus...@hotmail.de>
wrote:
You can tell Visual Studio to run your application with a special command
line argument. Click Project -Properties -Debug and enter "/debug" as an
argument. Use the following if-statement in your program to detect if it was
started from Visual Studio:

string[] args = Environment.GetCommandLineArgs(); // remove this line if
your program is a console application
if (args.Length 0 && args[0] == "/debug")
// started from VS
else
// not started from VS
Thank you
>
I'm sure there are more elegant solutions but this is one of the easiest.

"bz" <bzam...@gmail.comschrieb im Newsbeitragnews:fc******************************** **@e1g2000hsh.googlegroups.com...
Hi,
I need to detect at runtime if the application was started from VS
2005. Is it possible?
Also, how can I know at runtime of app is built for Debug or Release?
Thanks- Ascunde citatul -

- Afișare text în citat -
Nov 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.