Error: “sgen.exe” exited with code 1

While building a project or solution, if  you get the error like: “sgen.exe” exited with code 1, then the most probable reason is because you have a different version of the same project’s DLL in the GAC.

Solution:

  1. Open the GAC (C:\Windows\Assembly), find the DLL corresponding to your project.
  2. Right click on it and select uninstall

Now re-build your project and the problem must be gone.

11 Responses

  1. Thank you, I was experiencing this exact problem and your solution worked perfectly =)

  2. AWESOME! I was looking for a solution to this problem for a few days. Thanks for the info! Worked great.

  3. Sure thing🙂

  4. Thanks allot, I have tried different ways but no able to solve. Your solution worked perfectly😀

  5. I’ve also encountered cases where I neglected to check the project out of SourceSafe and sgen can’t write to the folders it needs access to. Especially easy to run into when what you’re building is a dependency of the project you really want to run.

  6. Thanks a bunch! It worked for me.

  7. Another thank you…you saved me a LOT of frustration!

  8. Thank you. It woked for me. Saved a lot time.

  9. Thank you. It worked for me too.

  10. Awesome… Worked like CHARM!!!

  11. Thanks, so simple solution, but so hard to find🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: