// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. using System; using System.Diagnostics; using System.IO; using System.Reflection; namespace Tools.DotNETCommon { public static class AssemblyUtils { /// /// Gets the original location (path and filename) of an assembly. /// This method is using Assembly.CodeBase property to properly resolve original /// assembly path in case shadow copying is enabled. /// /// Absolute path and filename to the assembly. public static string GetOriginalLocation(this Assembly ThisAssembly) { return new Uri(ThisAssembly.CodeBase).LocalPath; } /// /// Version info of the executable which runs this code. /// public static FileVersionInfo ExecutableVersion { get { return FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().GetOriginalLocation()); } } } }