Previous | Index | Next 

[PRB] Errors when doing unit testing or using reflection to explore the support library

If you use the Test Wizard included in Visual Studio to create unit tests for a .NET project generated by VB Migration Partner, the following exception occurs:

The following error was encountered while reading module 'CodeArchitects.VBLibrary': 
Assembly reference not resolved: InetCtlsObjects, Version=, Culture=neutral, 

This exception occurs also when a .NET application – either converted from VB6 or created from scratch – attempts to enumerate all the types in the CodeArchitects.VBLibrary.dll assembly. (Which, in fact, this is exactly what the Test Wizard attempts to do when generating unit tests.)

To understand why this exception occurs, you should keep in mind that the CodeArchitects.VBLibrary assembly includes a few classes which depend on external libraries. Most notably, the wrapper classes for the following controls depend on ancillary DLLs that have been installed in VB Migration Partner’s main folder:

  • Data (DAO.DLL)
  • INet  (InetCtlsObjects.dll)
  • MAPIMessages, MAPISession (MSMAPI.DLL)
  • MSComm (MSCommLib.dll)
  • RDO Data (RDO.DLL)
  • ScriptControl (MSScriptControl.dll)

In addition, a few other classes – e.g. the DataEnvironment and the ADO Data control - depend on the adodb.dll assembly that is installed in the GAC when you install Visual Studio, or the complete .NET Framework SDK.

If the original VB6 project uses one of these controls, VB Migration Partner dutifully copies the corresponding DLL into the .NET project’s folder, else the migrated project could not run correctly.

However, if an external .NET application – including the Test Wizard – uses reflection to explore all the types found in the CodeArchitects.VBLibrary assembly, then the six DLLs listed above are necessary and should be copied in the Bin/Debug (or Bin/Release) folder of the migrated .NET project.

In addition, if you are running the code on a computer where neither Visual Studio nor the .NET Framework SDK is installed, then you should adodb.dll in the list of files to be copied.


Previous | Index | Next