SQL Comparison SDK 11

Help for older versions available.

These pages cover SQL Comparison SDK 11, which is not the latest version. Help for other versions is also available.

Licenses.licx is not a valid Win32 application

Versions: 3,4,5,6,7.1*
Platform: 64-bit editions of Windows
Fix version: SDK 7.0 assemblies are compiled as "Any CPU" and should not encounter this issue
*NB this error will also happen in version 7.1, but only when RedGate.BackupReader.dll is used. This DLL will only run properly in a 32-bit environment, so referencing this DLL in your project will require you to compile it specifically for x86.

When compiling a Toolkit application in Visual Studio 2005 on a 64-bit operating system, a BadImageFormatException is thrown indicating that Licenses.licx is not a valid Win32 application.

The root of the issue is that the licence compiler (lc.exe) that is part of the Framework comes in a 32-bit and a 64-bit version. When compiling a Toolkit application on a 64-bit OS, the 64-bit lc.exe is invoked, leading to the exception message.

You can work around this by setting pre and post-build events to control the compilation of the licence. This, in addition to choosing the target CPU as 32-bit, will allow your project to compile and licence successfully. In VS 2005, right-click the project and select properties. Next, click 'Build Events'.
Set a new pre-build event:
c:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe setwow
Set a new post-build event:
c:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64 set64

The paths may differ based on the installation folder of your .NET Framework.





Didn't find what you were looking for?