Re: Detect if app was started from VS



On 18 Noi, 10:35, "Christoph Hausner" <christoph_haus...@xxxxxxxxxx>
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...@xxxxxxxxx> schrieb im Newsbeitragnews:fc1d3b1e-85d0-4693-98f9-533e8a15051a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



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 -

.



Relevant Pages

  • batch commands in "my_platform.bat"
    ... Then I go to VS.NET 2005 and change between debug and release version, ... console make a set BSP, but in the listed variables, the BSP_LAN does not ... Visual Studio 2005. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Detect if app was started from VS
    ... You can tell Visual Studio to run your application with a special command ... Use the following if-statement in your program to detect if it was started from Visual Studio: ... how can I know at runtime of app is built for Debug or Release? ...
    (microsoft.public.dotnet.general)
  • New C# programmer questions
    ... one of them, but that just isn't it, according to Visual Studio 2008. ... So I was hoping somebody could tell me how to kill my ... Console application when the user wants to. ... me how to link code files together so I can have multiple classes ...
    (microsoft.public.dotnet.languages.csharp)
  • Strange compiler bug
    ... I have a console application, one that will be a service at the end of the ...
    (microsoft.public.vc.language)
  • Re: Using Visual Studio 2005 Bootstarpper
    ... It's a button on the Properties page of a Setup project. ... I have read "Use the Visual Studio 2005 Bootstrapper to Kick-Start Your ... be accessed from the property pages for Windows Application, Console ...
    (microsoft.public.vstudio.general)