CSharp examples for System.Reflection:Assembly
Get Assembly File Version
/* //from w w w. ja va2s . com * $Id$ * Copyright 2008-2015 The Eraser Project * Original Author: Joel Low <lowjoel@users.sourceforge.net> * Modified By: * * This file is part of Eraser. * * Eraser is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * A copy of the GNU General Public License can be found at * <http://www.gnu.org/licenses/>. */ using System.Diagnostics; using System.Reflection; using System.Text; using System.Linq; using System.Collections.Generic; using System; public class Main{ public static Version GetFileVersion(this Assembly assembly) { FileVersionInfo version = FileVersionInfo.GetVersionInfo( assembly.Location); return new Version(version.FileMajorPart, version.FileMinorPart, version.FileBuildPart, version.FilePrivatePart); } }