jwaliszko
jwaliszko

Reputation: 17064

Where to find the assembly configuration information?

in AssemblyInfo.cs file I have following subection:

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

Where this information can be seen after assembly is built ? Since there is nothing about it in file details:

enter image description here

where else can it be found ?

Regards

Upvotes: 12

Views: 7216

Answers (3)

j0tt
j0tt

Reputation: 1108

You can use reflection to get this information. I believe it would be something like the following.

Assembly assembly = Assembly.GetExecutingAssembly();
object[] attributes = assembly.GetCustomAttributes(true);
var config = attributes.OfType<AssemblyConfigurationAttribute>().FirstOrDefault();
if (config != null) {
        Debug.WriteLine(config.Configuration);
}

Thinking about it further is this your intent?

How to check if an assembly was built using Debug or Release configuration?

The blogpost linked from the top answer shows a better way to determine if the assembly is Debuggable: http://stevesmithblog.com/blog/determine-whether-an-assembly-was-compiled-in-debug-mode/

One answer indicates that if you use the AssemblyDescription attribute to conditionally include Release/Debug in the text you can have that information in Windows Explorer.

Upvotes: 13

Shawn
Shawn

Reputation: 9402

You can use ILDASM.exe to look at the compiled assembly. See http://msdn.microsoft.com/en-us/library/ceats605.aspx for info on using ILDASM.exe.

Or you may use Reflection to look at it via code, such as System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes()

Upvotes: 3

dkackman
dkackman

Reputation: 15559

The Windows Explorer property sheet pulls that information from the win32 VERSIONINFO resources. A number of assembly attributes can be mapped to win32 resource fields (and will be set by the build) but it may be that the AssemblyConfiguration attribute is not one of them.

If you want to look at all assembly attributes, including those that don't set win32 resource fields, .NET Reflector is one option.

Upvotes: 1

Related Questions