El Blanco's Office 2007 Blog

Friday, October 13, 2006

"sgen.exe" exited with code 1

Not a MOSS 2007 blog post as such, but an irritating bug I found whilst developing a MOSS application using VS.NET 2005. Building in debug has worked fine for many weeks now, eventually I've got around to building a release build.

Two of the projects in my solution contain web references to a web service and both of these projects were failing with the error: "sgen.exe exited with code 1".

It turns out that even though sgen.exe is passed the /assembly parameter it can ignore this and look at a previous version of the assembly stored in the GAC - hence, if you see this problem, remove the assembly in question from the GAC and it appears to get around the problem and build OK.

5 Comments:

  • Farewell, I have spent time at your site very pleasantly
    _____________________________
    http://www.workerbees.biz/images

    By Anonymous Anonymous, at 4:40 pm  

  • I found that following the steps below fixed it:

    Open up the project properties.
    Open up the build tab.
    Set "Generate Serialization Assembly" to "Off"

    By Anonymous Anonymous, at 3:59 pm  

  • You sir are a god. I've found this problem hawked around the web and there have been many suggestions "remove and re-add project", "generate serialization assembly = off". None of them really made sense.. until yours!!!

    I removed existing assemblies from the GAC and all works.

    FYI anonymous #3, the serialization assembly is created for a reason (serialization) so switching it off isn't always a good idea. since I want to serialize things I really want this too!

    By Blogger Unknown, at 11:04 am  

  • Thank you so much! I followed your tip of removing assemblies from the GAC and it worked like a charm!

    By Anonymous Anonymous, at 6:27 pm  

  • Thanks a lot for posting this. I've followed your instructions and it worked!

    By Blogger Henrique Zacchi, at 12:39 pm  

Post a Comment

<< Home