Assembly and File Version Information in WinRT

How to get the assembly and file version information in WinRT apps

Short and simple post this time. If you need to get the assembly and file version information in your Windows Store app, here is what you need. Note that the using System.Reflection is important since the GetTypeInfo() method is an extension method in that namespace.

using System;
using System.Reflection;

namespace Example
{
    public class VersionInformation
    {
        public VersionInformation()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;
            var assemblyVersion = assembly.GetName().Version.ToString();
            var fileVersion = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
            var productVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
            System.Diagnostics.Debug.WriteLine("Assembly Version: " + assemblyVersion);
            System.Diagnostics.Debug.WriteLine("File Version: " + fileVersion);
            System.Diagnostics.Debug.WriteLine("Product Version: " + productVersion);
        }
    }
}

Similar, but slightly different than in other versions of .NET since Assembly.GetExecutingAssembly() and System.Diagnostics.FileVersionInfo are not available. Hope that helps somebody out.

 

@briandunnington


2018.03.25

The many uses of Azure Functions Proxies

Azure Functions Proxies are awesome - here are just a few ways to leverage them

View details »


2018.03.12

Build an Alexa skill using Azure Functions

Although AWS Lambdas are the default, it is dead simple to use Azure Functions for your Alexa skill as well

View details »


2018.02.28

Roll Your Own React

(on Roku, just for an added twist)

View details »


2018.02.06

Streaming live drone footage using Azure Media Services

Directly from your drone to the world, via the the cloud

View details »


2017.07.07

Redux + Roku = Redoku

Making Roku development less painful by making state changes more predictable

View details »


More Posts >