In VS 2005, it is building the solution in "Debug" mode correctly. But, when i try to build the solution in "Release" mode i got the error "'sgen.exe' exited with code 1".
Solution:
- Open the GAC (C:\Windows\Assembly), find the DLL corresponding to your project.
- Right click on it and select uninstall.
- Now, re-build your project and the problem must be gone.