maandag 22 maart 2010

MOSS - Could not load file or assembly 'cablib' or one of its dependencies. An attempt was made to load a program with an incorrect format.

When doing a upgrade of some WSP packages on a acceptation server I encountered the following error on several MOSS sites hosted in this machine:

Could not load file or assembly 'cablib' or one of its dependencies. An attempt was made to load a program with an incorrect format.

This did not happen on the dev or test environment, so what is happening here? I found out that cablib.dll was accidentally included in the WSP package. The WSP wad targeting the BIN directory of several SharePoint webapps. (We use WSP builder to create our WSP packages.) Cablib.dll is compiled for 32-bit only, when adding this dll to the bin directory of a 64 bit ASP.Net application, asp.net dies quickly. This did not cause a problem for our dev and test environment because they are 32-bit machines!

The fix was simple, clean your output directories to remove the cablib.dll from your WSP package and upgrade the WSP.