masterlodi
MIS
Why does the AssemblyTitleAttribute and AssemblyCopyrightAttribute return the correct values but AssemblyVersionAttribute always returns an empty string?
I've specified the version in the assembly!
I've specified the version in the assembly!
Code:
Assembly^ assy;
try
{
assy = Assembly::LoadFile(gcnew String(lpFilename));
}
catch( Exception ^ e)
{
MessageBox::Show(e->Message);
}
InitializeComponent();
// Iterate through the attributes for the assembly.
System::Collections::IEnumerator^ myEnum = Attribute::GetCustomAttributes( assy )->GetEnumerator();
while( myEnum->MoveNext())
{
Attribute^ attr = safe_cast<Attribute^>(myEnum->Current);
// Check for the AssemblyTitle attribute.
if(attr->GetType() == AssemblyTitleAttribute::typeid)
lblAppName->Text = dynamic_cast<AssemblyTitleAttribute^> (attr)->Title;
// Check for the AssemblyVersionAttribute attribute.
else
// Check for the AssemblyVersionAttribute attribute.
if(attr->GetType() == AssemblyVersionAttribute::typeid)
lblAppVersion->Text = dynamic_cast<AssemblyVersionAttribute^>(attr)->Version;
// Check for the AssemblyCompany attribute.
else
// Check for the AssemblyCopyright attribute.
if(attr->GetType() == AssemblyCopyrightAttribute::typeid)
lblAppCopyright->Text = dynamic_cast<AssemblyCopyrightAttribute^>(attr)->Copyright;
}