User Tools

Site Tools

blog:2024-08-27_001



2024-08-27 C#: 取得 Application Assembly 版本與 Build 版本

  • Separate assembly version of Major, Minor, Build, Revision numbers
  • Version _stdVersion = new Version();
    this.Text = "TEST V" +
    System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() +
    "." +
    System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() +
    "." +
    System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString() +
    " (Build " +
    System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString() +
    ")"
    ;

OLD

  • System.Reflection.Assembly _assembly = System.Reflection.Assembly.GetExecutingAssembly();
    System.Diagnostics.FileVersionInfo _fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(_assembly.Location);
    
    string _fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
    string _productVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;
    string _version = _fvi.FileVersion;
    this.Text = "Test V" + _version;

TAGS

  • 26 person(s) visited this page until now.

Permalink blog/2024-08-27_001.txt · Last modified: 2024/08/27 14:34 by jethro

oeffentlich