Simplifying your Build Server

One of the tasks that the dev team at [Intilecta] has spent quite a bit of time on recently is reworking the build process.  Having been involved in the v1 build process I have been adding my 2 cents worth from time to time.  One such area was how to minimise the bits of software we need installed on the build server.

We are going to need a tool that can execute a build.  The obvious choice was to go with MSBuild since it comes with the .NET Framework v2.  Unfortunately at this stage we can’t get away without having [VS2005] installed as we need it to build our setup projects (we are hoping to change that later this version).

The next area we had to consider was how we handle the 3rd party control libraries we have installed.  At this stage we are using Infragistics and Dundas controls.  Both of these products have a substantial install which includes adding various assemblies to the GAC.  We wanted to be able to control the build process so that we don’t need these to be installed on the build machine.  Unfortunately doing this with the projects in their current form meant that we were getting compile errors similar to:

Error 1 Exception occurred creating type ‘Infragistics.Win.UltraWinTree.UltraTree, Infragistics2.Win.UltraWinTree.v6.3, Version=6.3.20063.1059, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb’ System.ComponentModel.LicenseException: Unable to locate license assembly. C:…licenses.licx

It turns out that these errors are caused by the license management framework (which AFAIK is actually part of the .NET Framework to support third party component vendors) as a result of having a license.licx file included in the project.  To see this (for VB.NET projects) you need to set Solution Explorer to show all files.  This file will then appear under the My Project folder (VB.NET) or Properties folder (C#) – it’s set as an Embedded Resource.

My understanding of how the license checking works goes like this: Having the licx file in the project causes the framework to try to create an instance of the class defined in the licx file.  As part of the constructor this class does some license checking to see if it is being run on a licensed development machine (control libraries are typically licensed on a per dev/per seat basis).  In the case of our build machine we haven’t installed the product so it fails this check and hence fails to create the object defined in the licx file.

If we remove the licx file the build starts to work (you also need to change the references from being references in the GAC to being references to the actual dlls since you don’t want to have to add the control libraries to the GAC on the build machine just so you can do a build).  This gives us a solution for our build process….. BUT

So why do we need the licx file at all?  Well if you now open the project and attempt to work with a form/panel/control that makes use of a 3rd party control you will get an exception similar to (if you don’t have the control library installed):

Unable to locate license assembly.
at Infragistics.Shared.UltraLicenseProvider.GetDesignTimeLicense(Type type, Object instance, Boolean allowExceptions, UltraLicenseBaseAttribute licenseAttribute)
at Infragistics.Shared.UltraLicenseProvider.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at Infragistics.Win.UltraWinTree.UltraTree..ctor()

If you do have the library installed the licx gets created when you open the designer.  Just watch that you don’t check it back into source control with your project!

Leave a comment