Hi Pony,
Based on my understanding, you wanted to determine if the assembly is built
in debug build or release build at runtime.
If your assembly is built from VS2005, the VS2005 will define DEBUG
constant in debug build. You may check this from the Project | Properties
dialog box go to Configuration Properties - Build. The top item on the
right will be Conditional Compilation Constants. By default the value of
this property will be TRACE;DEBUG for debug builds and just TRACE for
release builds.
You can use code similar to the following to detect the build mode at
runtime:
bool runtime = false;
#if( DEBUG )
runtime = true;
#endif
If you are not using VS2005, the above DEBUG constant does not exist. Since
the compiler will emit DebbugableAttribute, you have to check
DebbugableAttribute in the assembly metadata using Reflection, see the link
below:
"How to tell if an existing assembly is Debug or Release build"
http://msmvps.com/blogs/bill/archive/2004/06/17/8339.aspx Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.