User Tools

Site Tools

blog:2023-09-23_c_build_information



2023-09-23 C#: Build Information

  • Example for shown program build information
  • private void SETTINGS_MenuHelpAbout()
    {
      String _str = String.Empty;
      bool _DebugMode = false;
    
      var _assm = Assembly.GetExecutingAssembly();
      System.Diagnostics.FileVersionInfo _fileInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(_assm.Location);
    
      // Program Title 
      _str = _fileInfo.ProductName + "\r\n"; //
    
      // Company Info
      _str += _fileInfo.CompanyName + " Corp.\r\n";
    
      // Version
      _str += "Version: " + _fileInfo.FileVersion + "\r\n";
    
      // CopyRight
      _str += _fileInfo.ProductName + " " + _fileInfo.LegalCopyright + " 2010 - 2023" + "\r\n";
    
      HELP_CheckReleaseMode(ref _DebugMode); // Check release mode
      if (!_DebugMode)
      {
        // Release Mode
        _str += "Revision:" + _fileInfo.ProductVersion + "\r\n";
      }
      else
      {
        // Debug Mode
        _str += "Debugging mode in IDE\r\n";
      }
    
      MessageBox.Show(_str, 
                      "Information",
                      System.Windows.Forms.MessageBoxButtons.OK, 
                      System.Windows.Forms.MessageBoxIcon.Information);
    }
    
    [Conditional("DEBUG")]
    private void HELP_CheckReleaseMode (ref bool para_Value)
    {
      para_Value = true; // Release Mode
    }
    

TAGS

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

Permalink blog/2023-09-23_c_build_information.txt · Last modified: 2023/09/23 16:59 by jethro

oeffentlich