The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Determining if a C#/VB.NET assembly was compiled as DEBUG or RELEASE

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jeff Key

Posts: 481
Nickname: jeffreykey
Registered: Nov, 2003

Jeff Key is legally sane, but questionably competent.
Determining if a C#/VB.NET assembly was compiled as DEBUG or RELEASE Posted: Nov 23, 2003 10:18 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Jeff Key.
Original Post: Determining if a C#/VB.NET assembly was compiled as DEBUG or RELEASE
Feed Title: Jeff Key
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/jkey/Rss.aspx
Feed Description: Topics revolve around .NET and the Windows platform.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jeff Key
Latest Posts From Jeff Key

Advertisement

I had to figure this out a couple days ago and the answer isn't what you'd expect:  It's not FileVersionInfo.IsDebug or IsRelease, as neither compiler flips the required bit.  As far as I can tell, the only way is to look for a DebuggableAttribute on the assembly.

static void Main(string[] args) 
{
    Assembly assm = Assembly.LoadFrom(args[0]);
    bool found = assm.GetCustomAttributes(typeof(DebuggableAttribute), false).Length > 0;
    Console.WriteLine("Assembly is {0}.", found ? "debug" : "release");
}

Read: Determining if a C#/VB.NET assembly was compiled as DEBUG or RELEASE

Topic: How to Save Web Accessibility from Itself Previous Topic   Next Topic Topic: A .Net Developer's Guide to Windows Security

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use