Forum Discussion

morde's avatar
morde
Contributor
10 years ago

Get the current installed version -C#

Hi there,



I am looking for a way to save in a variable (with C#) the value of the current TestComplete version installed on the machine. 

I noticed the Registry containes only folders with the names 10.0 or 9.0 and I prefer to get the full number (10.30 / 9.31 /...).

Is there a way - with or without registry access?



Thanks :)

 

2 Replies

  • Hi,



    you can use:



    FileVersion=Sys.Process("TestComplete").FileVersionInfo
  • Thank you Sivan :)



    I was actually searching for the C# code and way to do so from VisualStudio and not from TC (althogh it's nice to know it's available from there too). 



    Eventually I found a way, not a neat one though...


     


            DirectoryInfo latestDir = new DirectoryInfo(tcDirs[0]);


            // a loop search for the newest directory....


            string tcFileFullName = latestDir.FullName + "\\bin\\TestComplete.exe";


            FileVersionInfo tcFile = FileVersionInfo.GetVersionInfo(tcFileFullName);


            return tcFile.FileVersion.ToString();





    Thanks again for your answer