Development/EXE

rbulph

Junior Contributor
Joined
Feb 17, 2003
Messages
397
How do you determine within an application whether it is running in the development environment or an exe? In VB 6.0 I always did it by using a Debug.Assert statement, but I imagine there is a simpler way in .net.
 
Under .Net you are always running as an exe regardless of how the application was launched.
However you can always check System.Diagnostics.Debugger.IsAttached to see if a managed debugger is attached to the process.
Another thing to be aware of is the difference between Debug and Release builds of software and how that can affect run-time behaviour.
 
Conditional Compilation will only tell you whether you compiled with the debug=true flag and thus have debugging symbols or not. You can still attach a debugger to a process that doesn't have dubugging symbols. You'll only get a call stack and assembly (maybe IL in this case?), but you can still attach a debugger.
 
PlausiblyDamp said:
Under .Net you are always running as an exe regardless of how the application was launched.
However you can always check System.Diagnostics.Debugger.IsAttached to see if a managed debugger is attached to the process.
Another thing to be aware of is the difference between Debug and Release builds of software and how that can affect run-time behaviour.
OK, so the Debug build is built every time you run (debug) the application in the development environment and is then run. It's a bit bigger and a bit slower than the Release build. The Release build is built when you select Build from the menu in the development environment. Fine.

Why do these two exes and associated files get duplicated in the solution directory, in that they appear under both a "bin" and an "obj" directory?
 
The type of output is decided by the dropdown on the toolbar - Debug and Release being the default.
The bin directory is the final output of the build process, the obj directory is a tempory location that the files are generated in during the build process.
 
PlausiblyDamp said:
The type of output is decided by the dropdown on the toolbar - Debug and Release being the default.
The bin directory is the final output of the build process, the obj directory is a tempory location that the files are generated in during the build process.
OK, will ignore the obj Directory. Can't see any such dropdown (am using 2005 version - see screenshot). The second toolbar showing in the screenshot is the Build toolbar, but it just allows you to build the release exe for the solution or al exes and dlls for the current project, not any debug exes/dlls.
 

Attachments

Back
Top