Retrieving assembly attributes

posted Jun 30, 2014, 4:39 PM by Lesley Bross
Our UI prints the version of LANDIS that is installed before running. For the console app, this information is stored in the application configuration file. But the new widgets don't have access to this file because it is in a separate application. I did find the same information in a SharedAssembly.cs file in the Core. It took a little while but I figured out how to pull this information out of the compiled assembly.

To get a handle to the assembly, you need to get the Type of one of the classes it contains. If the class is not in the executing assembly, you need to qualify it, like this:
Type t = Type.GetType("Landis.Model,Landis.Core.Implementation");

I need to check to see if we want to keep track of the Widget UI version separately ...