Tuesday, May 19, 2009

WSPBuilder Fails to Copy Assembly to GAC

Small tip I just found when having an issue using the WSPBuilder "Copy to GAC" option.

For this one particular web part assembly, when selecting that WSPBuilder "Copy to GAC" option from the context menu in Visual Studio, the copy operation failed with the following message:

System.BadImageFormatException: The module was expected to contain an assembly manifest

Examining the references in that Visual Studio project, I found that one reference for some reason had the "Copy Local" property set to True. By setting this to False (and thereby matching the settings for all the other references), the assembly successfully copies to the GAC using WSPBuilder