Retrieve version of the CodeSite Tool

Home Forums CodeSite Retrieve version of the CodeSite Tool

Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #4098
      Hans Brand
      Participant

        Hi Ray,

        Is it possible to retrieve the version of the CodeSite Tool that I am connecting to?
        I was not able to find this in the Help document.

        I would like to inform users when they are using an old version.

        Also I would like this information to appear in the log files.

        Kind regards,
        Hans Brand

      • #4099
        Ray Konopka
        Keymaster

          Hi Hans,

          Interesting question. There is no built-in way to get that information, but we can leverage the SendFileVersionInfo method in the TCodeSiteLogger. For example, the following code shows how to get the file path to the CSDispatcher.exe from the Registry and then use the SendFileVersionInfo method to send the version info the CodeSite destination. The version number is listed in the details. Perhaps this will help until I can put something a little more elegant into the product.

          Ray

          uses
            System.Win.Registry,
            CodeSiteLogging,
            CodeSitePlatform;
          
          procedure TForm45.RzButton1Click(Sender: TObject);
          var
            R: TRegistry;
            DispatcherFileName: string;
          begin
            R := TRegistry.Create;
            try
              R.RootKey := HKEY_LOCAL_MACHINE;
              if R.OpenKeyReadOnly( CodeSiteRegKey ) then
                DispatcherFileName := R.ReadString( 'Dispatcher' )
              else if R.OpenKeyReadOnly( CodeSitePoliciesRegKey ) then
                DispatcherFileName := R.ReadString( 'Dispatcher' );
              R.CloseKey;
            finally
              R.Free;
            end;
          
            if DispatcherFileName = '' then
              DispatcherFileName := StrDispatcherExeName;
          
            CodeSite.SendFileVersionInfo( DispatcherFileName );
          end;
      Viewing 1 reply thread
      • You must be logged in to reply to this topic.