You can tell in wich configuration your code is compiled by compiler
directives:
#if DEBUG
//Add code here
#else
//add code here
#endif
you can set the soulution configuration (DEBUG/RELEASE) in the Project
Property Pages, Configuration Manager.
This is not exactly an answer to your question. The executed code is the
same as compiled .exe and in the IDE. But you can make a difference to your
debug version and release version.
The System.Diagnostics.Debugger.IsAttached property will indicate whether a
debugger is attached to your process. However, the VStudio IDE is not the
the only possible debugger. Are you perhaps more interested in whether your
component is being used in design mode within the IDE?
If this is a Windows Forms component, you can use the DesignMode property of
any type that inherits from System.ComponentModel.Component (which most
controls and forms do). For an ASP.NET control, you should instead check if
there is an HttpContext. i.e.: <in design mode> = (HttpContext.Current ==
null).