I have a control which retrieves the Assembly Attributes and stores them.
When a user uses my control. I'd like to have it display the assembly info for the program that person is running.
As of now it will only display the assembly info that i created when i designed the control.
I've tried using the following code. When this code is finished executing... it returns "System.Windows.Forms.dll"
i'm looking for it to return the title of the program that owns this control.
Take note i am using the method System.Reflection.Assembly.GetCallingAssembly not GetExecutingAssembly.
GetExecutingAssembly returns my controls attributes instead.
is what i'm doing possible? it seems like there is a method somewhere to help me accomplish this
I'd really appreciate an answer on this one. This bug is really hurting the flexibility of the utility i'm writing.
brandon
When a user uses my control. I'd like to have it display the assembly info for the program that person is running.
As of now it will only display the assembly info that i created when i designed the control.
I've tried using the following code. When this code is finished executing... it returns "System.Windows.Forms.dll"
i'm looking for it to return the title of the program that owns this control.
Take note i am using the method System.Reflection.Assembly.GetCallingAssembly not GetExecutingAssembly.
GetExecutingAssembly returns my controls attributes instead.
C#:
public void GetAttributes()
{
Assembly asmInfo;
AssemblyTitleAttribute atrTitle;
//set assembly variables
asmInfo = Assembly.Load(Assembly.GetCallingAssembly().GetName());
objAttributes = asmInfo.GetCustomAttributes(false);
//Convert from object to desired types
//Select Case needed because order of attributes in array varies
foreach(object objItem in objAttributes)
{
switch (objItem.GetType().ToString())
{
case "System.Reflection.AssemblyTitleAttribute":
{
atrTitle = (AssemblyTitleAttribute)objItem;
lblInfo.Text = atrTitle.Title.ToString();
break;
}
}
}
is what i'm doing possible? it seems like there is a method somewhere to help me accomplish this
I'd really appreciate an answer on this one. This bug is really hurting the flexibility of the utility i'm writing.
brandon