Another apparently simple question that uncovers a bug introduced in VS 2005 and 2008. Fortunately the workaround is simple:
HOWTO: Guess if a project configuration is Debug or Release from a Visual Studio add-in or macro
http://www.mztools.com/articles/2008/MZ2008005.aspx