"sgen.exe" exited with code 1

"sgen.exe" exited with code 1

Old forum URL: forums.lhotka.net/forums/t/494.aspx


david.wendelken posted on Wednesday, June 28, 2006

Got this error when I compiled Csla (c#) in release mode:

"sgen.exe" exited with code 1

Here's the solution I found, courtesy of http://blogs.vizibility.net/sdobrev/archive/2006/04/21/212.aspx:

If you are having this problem while building your VS.NET 2005 project in Release mode here is the solution:

Go to the project properties. Click on the build tab and set the value of the "Generate Serialization Assembly" dropdown to Off.

P.S. If you wonder for what is this sgen.exe here is explanation from the msdn: "The XML Serializer Generator creates an XML serialization 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."

The problem went away as promised.  Any reason for concern?

RockfordLhotka replied on Wednesday, June 28, 2006

Hmm. I don't see this error. I just rebuilt my current code (basically 2.0.2) in release mode, using VS, and see no errors in the output window or error list.

The only place where serialization assemblies could/should be created would be for the web services data portal channel. There's no where else in the framework that the XmlSerializer is used or is even valuable really.

david.wendelken replied on Thursday, June 29, 2006

Just went back and re-tested.

Visual Studio 2005 Team Suite, (trial), version 8.0.50727.42 (RTM.050727-4200), running on a Virtual PC.

With the project property "Generate Serialization Assembly" set to Auto or On, I get an error. 

From the Error List window after asking vs2005 to rebuild the project:

Error 1 "sgen.exe" exited with code 1. Csla

From the Output Window:

Compile complete -- 0 errors, 0 warnings
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:Z:\csla20cs\csla20cs\Csla\obj\Release\Csla.dll /proxytypes /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.configuration.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Design.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Runtime.Remoting.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /compiler:/keyfile:CslaKey.snk /compiler:/delaysign-
Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1892,9): error MSB6006: "sgen.exe" exited with code 1.
Done building project "Csla.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

 

I hadn't done anything with Csla on this box before, I had been working with it on two other machines with no problems.  Then again, I had only worked with Debug mode before.   I'll try the same thing at home and report whether the same situation exists on my "main" machine for csla dev, or whether it's localized to my virtual pc at work. 

Professor Rotwang replied on Thursday, May 10, 2007

David, did you ever get to the bottom of this? I'm getting the same error when trying to build the latest VB version of CSLA (2.1.4) in VMWare 5.5.3 (Win XP SP2 guest and host, VS 2005 SP1 Team Developer). I've narrowed it down to using VM shared folders as the location for the project files - if I copy them to the guest OS's C: drive then it builds fine - so obviously a problem with VMWare and not CSLA. However, I have always used shared folders for my other projects, but then they do not include web services and such fancy stuff - still a noob when it comes to .NET let alone CSLA!

I don't think that the setting
"Generate Serialization Assembly" is available in VB. I just wondered if you found another brilliantly simple solution (well, I can dream can't I?)

david.wendelken replied on Thursday, May 10, 2007

Sorry, but I just stopped using the virtual pc, and the problem went away.

 

Professor Rotwang replied on Friday, May 11, 2007

Thanks for replying. I think there is a latency issue with the shared folders in VM - it is almost as if the built files are not available to the sgen utility, but they are there when I look at them afterwards. I'll try the vmware support forums, or just not use shared folders. They are really useful though for sharing projects across various VMs and allowing me to copy them to other locations without starting VM.
Thanks again.

Copyright (c) Marimer LLC