Version - C#

Overview

This code requires a "Version.txt" file in the "ACME.Common" project with a Build Action of "Embedded Resource"

Code

using System.IO;
using System.Reflection;
public static class Version
{
    public static string Get()
    {
        /*--- Inits ---*/
        var assm = Assembly.GetExecutingAssembly();
        var version = string.Empty;
        var resourceName = "ACME.Common.Version.txt";

        /*--- Read Embedded Resource Content ---*/
        using (var stream = assm.GetManifestResourceStream(resourceName))
        {
            using (var reader = new StreamReader(stream))
            {
                version = reader.ReadToEnd();
            }
        }

        return version;
    }
}