Application version


Is it possible to get application version by code? which is set during the TinyCLR Config tool when creating the application.

I’am thinking something similar to the DeviceInformation.Version Device Information

I am away from a PC, but I would first look for an Assembly class for version info.

There is no built-in method to do that for now.

You can make one and keep this information somewhere in user storage sector.

The version you set in tinyclr config is saved in header which will be gone when load into the device. Only raw application data is saved into device.

Used a workaround

Setting the project → properties → Application → Assembly Information it is possible to set a assembly version and retrieve this by code using:

AssemblyName asm = Assembly.GetExecutingAssembly().GetName();
Debug.WriteLine($"Application version: {asm.Version}");

if in the project properties in the Assembly tab, clear the Revision field and enter “*” (without quotes) in the Build field then

var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
if (version != null)
  DateTime buildDate = new DateTime(2000, 1, 1).AddDays(version.Build).AddSeconds(version.Revision * 2);