You may want to use FileVersionInfo instead of or in attaion to these as they get passed into the .exe file and are viewable in explorer, whereas assembly attributes don’t

using namespace System::Windows::Forms;

Assembly attributes are basically global text strings that you can get at in your code.

Default Assembly Attributes

They are in the file: AssemblyInfo.cpp

[assembly:AssemblyTitleAttribute("My Ap Name")];
	//

[assembly:AssemblyDescriptionAttribute("")];
	//

[assembly:AssemblyConfigurationAttribute("")];
	//Use to specify the build configuration (e.g. retail, debug, etc)

[assembly:AssemblyCompanyAttribute("My Company Name")];
	//Company name - Often used when creating user direcotry for an application etc.

[assembly:AssemblyProductAttribute("My Ap Name")];
	//Product name - Often used when creating user directory for an application, naming message boxes, etc

[assembly:AssemblyCopyrightAttribute("Copyright (c)  2010")];
	//Often used in an about box

[assembly:AssemblyTrademarkAttribute("")];
	//

[assembly:AssemblyCultureAttribute("")];
	//

You can get at these in your code with Application:

Getting Version Attribute

Assembly ^assembly = Assembly::GetExecutingAssembly();
Version ^version = assembly->GetName()->Version;
lblVersion->Text = "Version: " + version;

lblVersion->Text = Application::CompanyName;
lblVersion->Text = Application::ProductName;

Setting Assembly Attributes In Code

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

Getting An Assembly Attribute In Code

Attribute ^Copyright = AssemblyCopyrightAttribute::GetCustomAttribute(System::Reflection::Assembly::GetExecutingAssembly(), AssemblyCopyrightAttribute::typeid);
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *