Getting at information entered in Assembly Information dialog
-
Wednesday, October 08, 2008 11:36 PMIn the Properties for a given WPF application (C#), one can enter the Title, Description, Company, Product, etc. in the Assembly Information dialog (Properties --> Application --> "Assembly Information..." ).
...but how can I read it at runtime?
there doesn't seem to be a straightforward way to get at that information, unless I'm missing something.
thanks!
evan k. stone / sr. ux developer / dragnet solutions, inc.- Edited by Evan Stone Wednesday, October 08, 2008 11:37 PM
Answers
-
Wednesday, October 08, 2008 11:58 PM
anything you enter inside Assemblyinformation dialog sits in the AssemblyInfo.csYou can access these values using Assembly.GetExecutingAssembly.GetCustomAttributes(true/false);If you print the types of attributes returned, you can see something like shown below.System.Windows.ThemeInfoAttributeSystem.Diagnostics.DebuggableAttributeSystem.Runtime.CompilerServices.CompilationRelaxationsAttributeSystem.Runtime.InteropServices.ComVisibleAttributeSystem.Reflection.AssemblyFileVersionAttributeSystem.Runtime.CompilerServices.RuntimeCompatibilityAttributeSystem.Reflection.AssemblyTitleAttributeSystem.Reflection.AssemblyDescriptionAttributeSystem.Reflection.AssemblyConfigurationAttributeSystem.Reflection.AssemblyCompanyAttributeSystem.Reflection.AssemblyProductAttributeSystem.Reflection.AssemblyCopyrightAttributeSystem.Reflection.AssemblyTrademarkAttributeSo if you want to access the Description entered in the Assembly, you can do something like this.foreach (object o in Assembly.GetExecutingAssembly().GetCustomAttributes(true)){if (o is AssemblyDescriptionAttribute) Debug.WriteLine((o as AssemblyDescriptionAttribute).Description);}That is just an example.Hope this helps.- Proposed As Answer by KrishnaBhargava Wednesday, October 08, 2008 11:59 PM
- Marked As Answer by Evan Stone Thursday, October 09, 2008 12:09 AM
All Replies
-
Wednesday, October 08, 2008 11:58 PM
anything you enter inside Assemblyinformation dialog sits in the AssemblyInfo.csYou can access these values using Assembly.GetExecutingAssembly.GetCustomAttributes(true/false);If you print the types of attributes returned, you can see something like shown below.System.Windows.ThemeInfoAttributeSystem.Diagnostics.DebuggableAttributeSystem.Runtime.CompilerServices.CompilationRelaxationsAttributeSystem.Runtime.InteropServices.ComVisibleAttributeSystem.Reflection.AssemblyFileVersionAttributeSystem.Runtime.CompilerServices.RuntimeCompatibilityAttributeSystem.Reflection.AssemblyTitleAttributeSystem.Reflection.AssemblyDescriptionAttributeSystem.Reflection.AssemblyConfigurationAttributeSystem.Reflection.AssemblyCompanyAttributeSystem.Reflection.AssemblyProductAttributeSystem.Reflection.AssemblyCopyrightAttributeSystem.Reflection.AssemblyTrademarkAttributeSo if you want to access the Description entered in the Assembly, you can do something like this.foreach (object o in Assembly.GetExecutingAssembly().GetCustomAttributes(true)){if (o is AssemblyDescriptionAttribute) Debug.WriteLine((o as AssemblyDescriptionAttribute).Description);}That is just an example.Hope this helps.- Proposed As Answer by KrishnaBhargava Wednesday, October 08, 2008 11:59 PM
- Marked As Answer by Evan Stone Thursday, October 09, 2008 12:09 AM
-
Thursday, October 09, 2008 12:10 AMThanks! I've implemented it already and it works perfectly!
evan k. stone / sr. ux developer / dragnet solutions, inc.

