Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SGEN: An attempt was made to load an assembly with an incorrect format

Tags:

c#

.net

msbuild

tfs

I have a project that can build fine on my local machine, however, when I get TFS to build it, I receive the following error -

SGEN: An attempt was made to load an assembly with an incorrect format:

After reading through many other posts here on this topic, most people just say I need to change the build type to either x86 or Any CPU, rather than x64, but after trying countless combinations, this was not the solution. My program is also a windows service, so setting the App Pool to allow 32 bit applications (as suggested by others) is also not the solution.

like image 697
Paul McLean Avatar asked Nov 14 '12 04:11

Paul McLean


1 Answers

I encountered this same issue today. A project would not build on my PC but built fine on other PC's

I eventually fixed it by doing the following:

Right-clicked the project with the error, went into Properties

Selected the Build tab and went to the last option which is "Generate serialization assembly" I set this to Off and the project now builds fine.

like image 51
Dave Oakley Avatar answered Sep 27 '22 19:09

Dave Oakley