Ask a Question

Getting file version of GAC entries


Getting file version of GAC entries


When we work on service packs or patches of our software, we are required to verify whether the file version of certain dll's have been updated as expected. To go through the whole list of files manually is very time consuming and error prone, so we decided to automate it.

I am able to use the GetFileVersion method of FileSystemObject without any issues for files that are present under the C:\Program Files\Application\Bin directory however; I would like to know of a similar approach to get the versions of the assemblies that get registered in the GAC when our application is installed.

As a workaround, I open the 'assembly' window and from the 'Run' window and read the contents of the 'Version' column to get the job done but it would be good to know a non-GUI based alternative like the one above.

Thanks and Regards,

Valued Contributor


Hi GJ,

There is no built-in way to do this in TestComplete as well as in the .NET Framework. However, it is possible to get this information using the 'Gacutil' tool which is shipped along with the .NET Framework SDK. This SDK is installed along with Visual Studio or with the SDK of the operating system. The below script demonstrates how this tool can be used in TestComplete.

function test()


//  var items = getInstalledAssembliesList(); // Get all assemblies

  var items = getInstalledAssembliesList("MyCompany.MyNamespace.MyAssembly");

  Log.Message("Total " + items.length + " assemblies");

  for (var i = 0; i < items.length; i++) {

    Log.Message(items.Name, items.Version + "\r\n" + items.Culture + "\r\n" + items.PublicKeyToken);



function getInstalledAssembliesList(assemblyName)


  if (null == assemblyName) {

    assemblyName = "";



  var gacutilPath = "\"c:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin\\gacutil.exe\"";

  var header = "The Global Assembly Cache contains the following assemblies:";

  var footer = "Number of items =";

  var WshShellObj = new ActiveXObject("WScript.Shell");

  var WshShellExecObj = WshShellObj.Exec(gacutilPath + " /l " + assemblyName);

  var out = "";

  while (!WshShellExecObj.StdOut.AtEndOfStream) {

    out += WshShellExecObj.StdOut.Read(1);


  var strList = aqString.Trim(out.match(new RegExp("^.*" + header + "((\\s|\\S)*)" + footer + ".*$", "im"))[1]);

  var strArr = strList.split("\r\n");

  var assembliesList = new Array();

  for (var i = 0; i < strArr.length; i++) {

    var line = strArr.split(",");

    var item = new Object();

    item.Name           = aqString.Trim(line[0]);

    item.Version        = aqString.Trim(line[1].split("=")[1]);

    item.Culture        = aqString.Trim(line[2].split("=")[1]);

    item.PublicKeyToken = aqString.Trim(line[3].split("=")[1]);




  return assembliesList;

Dmitry Nikolaev

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️


Thanks to both of you for posting a suggestion ... I'll try them out and let you know my observations.


Showing results for 
Search instead for 
Did you mean: