C# winform獲取當前版本號

   public string AssemblyFileVersion()
        {

            object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
            if (attributes.Length == 0)
            {
                return "";
            }
            else
            {
                return ((AssemblyFileVersionAttribute)attributes[0]).Version;
            } 

        }

方法二

   //得到指定程序集版本
        private string GetAssemblyVersion(string name)
        {
            byte[] filedata = File.ReadAllBytes(name + ".exe");
            return Assembly.Load(filedata).GetName().Version.ToString();
      
        }

原文地址:https://www.cnblogs.com/yeye518/p/2231663.html