Vakul's .NET Realm

My journey towards .NET World…

  • Details

    Vakuls MCPD Certification Vakuls MCTS Certification Author's Pic



  • Blog Stats

    • 142,380 hits
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 355 other followers

  • Follow me in Twitter:




  • qrcode
  • Subscribe

  • del.icio.us:

Task Failed because “SGEN.EXE” was not found

Posted by Vakul Kumar More on July 6, 2011


I was approached by a colleague recently about an error related to “SGEN.EXE” when tried to build the project in release mode. This error is only for the release mode and in debug mode it works perfectly.

I researched further on the error:

Sgen.exe is an XML Serializer Generator Tool used to create an assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.

Sgen.exe generates the [libraryname].XmlSerializers.dll and will be used by the clients of webservices to speed up the time to load the webservice.

Solutions:

  1. Right click on the project and in the properties page of the project, click on the Build tab.
    Select Configuration: Release.
    At the bottom, Generate serialization assembly is set to AUTO. When it is AUTO in release mode, SGEN tries to create XML serialization assembly and fails. Set Generate serialization assembly to OFF. If it is set to OFF, Visual Studio never runs sgen.exe.
  2. Copy the sgen.exe file from  C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ to C:\WINDOWS\Microsoft.NET\Framework\v3.5\. I’m not sure if this is 100% solution.
  3. 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.
  4. Final solution would be to try refreshing from SourceSafe and if it wont solve the problem would be to destroy entire solution hierarchy and get a fresh version of solution to a new location.

I’m sure the first solution should solve the problem, 2nd and 3rd solution can be tried to solve the error.

Let me know if there is anything can be added in comments section.

Happy Coding Smile

 

Advertisements

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: