Previous | Index | Next 

[HOWTO] Create references to .NET assemblies with absolute path

By default, the all .NET projects that VB Migration Partner creates are “self-contained”, in the sense that their folder contain all the assemblies that are required for a correct compilation and execution. Such referenced assemblies – including VB Migration Partner’s support libraries and .NET libraries that you have converted previously – are stored in a subfolder named SupportDLLs. This arrangement allows you, for example, to perform XCOPY installation of migrated project to a different computer.

While the default behavior is fine in most cases, the fact that each project comes with a distinct set of (duplicated) DLLs can be a source of problems. In addition to disk usage waste, all these duplicated DLLs need to be manually updated if you rebuild the original assembly or if you installa a newer version of VB Migration Partner’s support libraries.

You can change the default behavior by including an AddLibraryPath pragma, like the following:

        '## AddLibraryPath "c:\NetPrograms\Converted DLLs"

The previous pragma affects VB Migration Partner’s in two ways. First, it searches the specified folder for any DLL that is the result of a conversion from VB6 – more specifically, any DLL that contains a VB6SupportLibrary attribute at the assembly level. Second, if the project being converted references a DLL found in this folder, then the assembly reference is made directly to the original DLL and the referenced DLL is not copied to the SupportDLLs folder.

Even if VB Migration Partner’s is always able to locate its own support libraries – which are stored in VB Migration Partner’s installation folder – you might want to copy these support libraries to another folder and use an AddLibraryPath pragma that points to that folder:

        '## AddLibraryPath "c:\NetPrograms\Support DLLs"

The neat effect of this pragma is that projects converted by VB Migration Partner will reference assemblies in the specified folder and won’t create a SupportDLLs subdirectory inside the project’s folder.

Keep in mind that AddLibraryPath pragmas can only be stored inside a *.pragmas file, either in the same directory as the VB6 project being migrated or in the “master” VBMigrationPartner.pragmas file inside VB Migration Partner’s installation folder. Using the latter file is a convenient way to specify an alternate location for the support libraries that are required by all migrated projects.


Previous | Index | Next