Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Version - C#

RSS
Modified on Thu, Jun 18, 2020, 12:24 PM by Administrator Categorized as ┬ĚNet Framework

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;
    }
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2020, Patrick Jasinski.