Using Different LL Versions in a .NET Application

Question

Since List & Label 26, the naming scheme followed by all List & Label classes is combit.Reporting. Ideally, this allows updating the used major version of List & Label without any code changes (except for the LicensingInfo property), since the List & Label version number has not been included in the namespace since then (think of combit.ListLabel25, for example, which had to be adjusted via find & replace in all places in the code).

However, for various reasons it may be necessary to use different main versions of List & Label in an application, for example for testing purposes. But how to do this if there is only one namespace?

Solution

The solution is to use aliases. We will show you how to implement this in just a few steps:

Step 1

Add the different List & Label assemblies as reference to the project.

Step 2

Open the Property Explorer for the respective assembly and change the Alias property from global to a self-selected alias name, for example ListLabel26 or ListLabel27.

Step 3

Time to adjust the code. The chosen alias label can now be used via the external keyword above the using statements:

extern alias ListLabel26;
extern alias ListLabel27;

Step 4

Within the using statements the respective alias for the namespace combit.Reporting can now be used:

using ll26 = ListLabel26::combit.Reporting;
using ll27 = ListLabel27::combit.Reporting;

Step 5

Afterwards, the respective List & Label object can be created as usual:

try
{
	using (ll26.ListLabel LL = new ll26.ListLabel())
	{
		LL.DataSource = myData();
		LL.Design();
	}
}
catch (ll26.ListLabelException llex)
{
	MessageBox.Show(llex.Message);
}