Ask a questionAsk a question
 

Answer"sgen.exe" exited with code 1

  • Wednesday, December 28, 2005 11:21 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am trying to build a project in VS 2005 but I am getting the error:

    Error 67 "sgen.exe" exited with code 1. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets 1892 9 TAI.Util

    This project had been building just fine earlier today. The only thing that happened between is I refreshed the web references in this project. As a test I added the same web references to a new project and it builds just fine.

Answers

  • Tuesday, January 03, 2006 7:49 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I seem to get the same message when I update the web references in the project. Removing the project from the solution and readding it seems to fix the problem.

All Replies

  • Thursday, December 29, 2005 5:31 PMFaisal Mohamood MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Have you tried building with Detailed or Diagnostic verbosity?  It seems that the error is certainly related to the generation of serialization assemblies for use with the web service. 

    Try building with a higher verbosity and see if that reveals more information.  Let us know what you find.

    Thanks.

    Faisal Mohamood
    Program Manager - MSBuild

  • Thursday, December 29, 2005 5:39 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks for the quick response.

    VS does the build so I'm not sure how to change the verbosity or view the messages it produces. I don't use MSBuild directly, but knowing how to view the messages may prove useful in the future.

    Since my original post, I managed to get the solution to build again by removing and re-adding the project that contains the web references.

     

  • Thursday, December 29, 2005 6:21 PMSayed Ibrahim HashimiModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You can customize the output from
    Tools->Options
    Then go to Projects and Soutions and click on Build and Run
    The MSBuild verbosity is the last drop down on that dialog box.

    Sayed Ibrahim Hashimi
    www.sedodream.com
  • Thursday, December 29, 2005 6:22 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks. I'm still getting used to the VS 2005. I'll give it a try.
  • Tuesday, January 03, 2006 7:13 PMMahesh_ChandramouliModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    I still get the same error after changing the verbosity level. Is there any other workaround.

     

     

     

  • Tuesday, January 03, 2006 7:15 PMSayed Ibrahim HashimiModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Can you insert the relevant portions of the log here?

    Sayed Ibrahim Hashimi
    www.sedodream.com
  • Tuesday, January 03, 2006 7:47 PMMahesh_ChandramouliModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Error 1 "sgen.exe" exited with code 1. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets 1892 9 IASTCFrameWork.Net

    It looks like a bug in VS 2005.

  • Tuesday, January 03, 2006 7:49 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I seem to get the same message when I update the web references in the project. Removing the project from the solution and readding it seems to fix the problem.
  • Tuesday, January 03, 2006 8:11 PMMahesh_ChandramouliModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    It worked after removing the reference and added back again to the solution, but i still feel that this a bug in the conversion tool.

     

  • Tuesday, January 03, 2006 8:13 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have this problem in a solution that has one converted web site project and a new class library project. The web references are in the class library project.
  • Wednesday, January 04, 2006 5:32 PMNeil Enns MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Mahesh, Birch,

    What exactly is your project structure? Are you doing an ASP.NET website, webservice, or something else? Were the projects originally created in Visual Studio 2003 and then upgraded to 2005? We need as much detail as you can provide on the projects in your solution so we can figure out which team needs to investigate this.

    Neil

  • Wednesday, January 04, 2006 6:12 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks for digging into this.

    The project started in VS 2003 (maybe even the version before that).

    In VS 2003 the solution consisted of a single webproject. It had 5 web references to web services published by a Java/BEA system all of which are internal to the company. These web services are for CRUD operations on the systems database.

    I used the Convert "Wizard" in VS 2005 to upgrade the entire solution to 2.0. After the conversion I broke the solution into two seperate projects. One contains just the aspx pages. The other is a newly created Class Library project. All of the web references were moved to the second project.

    I'd be happy to send you any of the files that would be useful for you to look at (although I don't see a way to include files through this page.)

  • Sunday, January 08, 2006 6:18 PMAntoninoCrudele Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    I resolve the problem, I think.

    You must set your output path in to bin\debug directory project

    in other mode you must use another security settings

    bye

    Nino

    info@ninocrudele.net

     

  • Friday, January 20, 2006 3:20 PMShawn Hubbard Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I'm also experiencing a similar problem. When i change the build options in the ConfigurationManager, i often get this error. The only way I've found to fix the problem has been to exit and restart Studio or, in some cases, to remove and re-add the project.

    I'm working with a solution that has 4 web projects and 3 project references, all written in 1.1 and converted to 2.0 using the wizard.

  • Friday, January 20, 2006 11:39 PMNoah Nadeau Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I just ran into the exact same issue today.  We have a 19-project solution, and this particular project, the so-called "vital organs", was causing issues once we changed the configuration to Release.  Exiting Visual Studio didn't help, and neither did removing and re-adding the project.  We just added a web reference today, so I wonder if that's part of the issue.  I didn't find any other resource, so I'm kind of stuck in Debug Mode for now...
  • Monday, January 23, 2006 8:27 PMbirch9397 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I don't know why, but I haven't been experiencing this problem since my last post. I haven't changed anything with my procedures other than maybe using the Clean and Rebuild instead of just Build for the project. Have you tried the Clean/Rebuild when experience the problem?
  • Friday, January 27, 2006 4:47 PMShawn Trevellick Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I received the same problem with a VS2005 project utilizing Web References.  I only get the sgen.exe error when the project is compiled in release mode.  When it is switched to Debug Mode, it compiles fine.

     

    Help?

  • Friday, January 27, 2006 5:19 PMNoah Nadeau Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The only resolution I found was to compile the project using the Web Reference in Debug mode.  Since we obfuscate the entire solution, it isn't vital for that particular project to run in release mode.  Your situation may be different, though.
  • Friday, February 17, 2006 11:01 AMCARPe Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    I have been with the same problem the last days. Last but not least i found the solution, at least for my case. I could compile in debug mode, not in release. The problem comes with the web reference when it appears in the project. Well, if you see the folder where your assembly is located, surely you will have a file like this: YourAssembly.XmlSerializers.dll.

    I founded this on http://primates.ximian.com/~lluis/blog/archives/archive_2004-m07.php

    There is also a new tool called sgen. If you run "sgen myassembly.dll" it will generate a new assembly called myassembly.XmlSerializers.dll that contains all serializers for all classes inside myassembly. When an application wants to serialize an object from myassembly, it will load the serializer from myassembly.XmlSerializers.dll. The goal of all this stuff is to avoid the cost of generating and compiling the serializers on the fly.

    The solution? Well, you can go to properties-build-generate serialization assembly and set to off this property, or each time you want to buid the project in release mode, delete de XmlSerializers.dll file you should find in the folder.

    Saludos/Kind Regards

    Adolfo

  • Friday, February 24, 2006 3:07 AMRicardoPretrazey Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am having exactly the same problem. I've got a solution with about 15 projects, one of which is throwing this 'sgen.exe exited with code 1' error.

    It has 4 web-references, which I've removed and re-added, but it still comes up with this error.

    I have changed to a high verbosity, and now have a massive text file.. I could email it if that helps you ?

    Please help, I'm stuck.

    Thanks

    Rich.

  • Wednesday, June 28, 2006 1:37 PMdavid wendelken Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Found this solution at 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."

    Worked like a charm!

  • Wednesday, August 30, 2006 3:41 PMColin BowernMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Myself and one of my devs experienced a similar issue.  In our case it worked great in debug builds, but failed in release builds.

    Here's what helped for us:

    In the output window the command line is echoed.  Copy that command line to a command prompt in the project folder adding a /k to the command line to preserve the temporary files.

    The temporary files have random names so look for a .out file and that will be the actual output from sgen.exe.

    In our particular case it appeared that sgen was attempting to overwrite a pre-existing assembly.  We knew there were none in the bin folder so we were puzzled.  The output showed us that sgen was ignoring the explicit path in the /assembly parameter and instead trying to generate based off an earlier version which resided in the GAC.  When we removed the instance of the assembly from the GAC everything worked great.

    Hope that helps.

    Cheers,
    Colin
  • Monday, September 25, 2006 8:29 AMriz332 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    If you are getting this error message, check your folder settings. Sometimes if you do not have access on the target folder, VS2005 exits the command line with this error code.

     

    Cheers,

    Rizwan

  • Friday, October 06, 2006 6:06 PMmsauper Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I received this error and diagnosed the problem as follows:

     

    I have three different solutions with various projects in them.  As an example, assume that I have three solutions, A, B, and C.

    Projects in Solution B reference libraries build in Solution A. Projects in Solution C reference libraries built in solution B and solution A. Some of the libraries referenced in Solution B also reference projects in Solution A.

    I was getting the error rebuilding a project in Solution C.   I finally diagnosed the problem to be that I had recompiled Solution A but not solution B.  Since C was referencing libraries in both A and B, the sgen.exe could not load the output of C, since the dependencies were conflicting, the project in C wanted one version of a library in A and a library from B wanted a different version of the same library from A.

    After getting all of the dependent libraries compiled in the correct order, the error went away.

    Hope this helps.

    Metro.

  • Monday, October 30, 2006 11:41 PMStefan Dobrev Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    More info on sgen.exe and why it fails. Read it here:

    http://blogs.vizibility.net/sdobrev/archive/2006/10/31/sgen.exe-continued.aspx

  • Tuesday, February 13, 2007 6:13 PMraymondbrady Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Seems to be related to the development web server that runs in the system tray. I just closed all the web servers running in the system tray and the error went away without removing the project from the solution.
  • Wednesday, March 28, 2007 4:02 PMDiego Jancic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
  • Friday, June 22, 2007 1:37 PMAns Vlug Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Disabling the generation of serialization assemblies works, however, this option is not available for VB Projects. To make this work for VB Projects:
    Add the tag
        <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    in the .vbproj file after the line
        <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  • Monday, June 25, 2007 11:35 AMTigraine Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     Ans Vlug wrote:
    Disabling the generation of serialization assemblies works, however, this option is not available for VB Projects. To make this work for VB Projects:
    Add the tag
        <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    in the .vbproj file after the line
        <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

     

    This worked perfectly for me.

    The .vbproj File had the GenerateSerializationAssemblies option to Auto for both Release and Debug builds.

    Sgen always exited with Code 1 because he couldn't overwrite the existing xy.XmlSerializers.dll

    I could make him compile by deleting the xy.XmlSerializers.dll, but that's no solution at all.

     

    greetings Tigraine

  • Wednesday, August 08, 2007 11:13 AMRaviGoli Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I was having trouble building a solution in VIsual Studio 2005 and I was getting the following error.

    "sgen.exe" exited with code 1  

     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"
  • Monday, August 13, 2007 6:56 PMFcoLomas Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have exactly the same problems, when i use the release config the problem appears, then i switch the Serialization Assembly Generation to Off and works, but it breaks the app, sometimes when you use web services some of the request generated by the proxy must be serialized, and the with the option off the app throws an exception telling you that can't generate an XML file, I'm using VSTS SP1, any ideas??
  • Thursday, November 15, 2007 3:59 PMJKuzhi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Do Clean Solution and Rebuild the Solution.

  • Sunday, January 06, 2008 12:50 PMTaha Amin Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    when you try to build a release version it gives an error/* "sgen.exe" exited with code 1 */

    From solution explorer right click the project ->properties  ->build tab->set generate serialization assembly to off

  • Wednesday, January 16, 2008 5:38 PMRashad Rivera Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer

    I got this issue with my 2005 web project (started as a 2005), after I added a custom web control to the web application project.  I also added a Toolbox reference to the new class in the solution and the next time I built the project, I got this error.  I tried restarting VS but that did not work.  What did work was changing the output directory by adding the "Debug" suffix.  I think that some DLL in volved with serialization of the project is causing the issue and this "sgen.exe" does not like it.  When I deleted all the DLL's in the "bin\" folder, I was able to restore the proper output directory.  Hope this helps.

     

    - Rashad Rivera

      www.omegusprime.com

     

  • Friday, February 15, 2008 9:20 AMndu Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I was also facing the same error in VS2005 for WebReference in the  Project.I removed the assembly registered in GAC(Global assembly Cache) and tried building the Project and it worked fine for me.

  • Tuesday, May 20, 2008 6:51 PMCLaucher Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This helped my issue!  Thanks!  I had the DLL GAC'd before adding the web reference, and so the GAC'd version was conflicting with the one being built.  I removed the GAC'd version and it built fine, and I

    re-added mine to the 2.0 GAC

     

    Chad Laucher

    http://chadlaucher.spaces.live.com/default.aspx

  • Wednesday, July 16, 2008 5:40 PMDanielWilson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    >>Disabling the generation of serialization assemblies works, however, this option is not available for VB Projects

    Yes, in VS2005 it is available.

    On the project properties, choose Compile, then click the Advanced Compile Options button.  Generate Serialization Assemblies is the 2nd option from the bottom.
  • Wednesday, October 01, 2008 10:10 AMHervé Soulié Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Hi!

    Assuming you have a problem with permissions with a shared reference, you may have to trust the shared directory using the caspol utility. (The sgen has this error when it can't get the good permissions)

    You may find usages and more informations following this link : http://blogs.msdn.com/shawnfa/archive/2004/12/30/344554.aspx

    Regards,
    Hervé

  • Thursday, November 06, 2008 2:53 PMR L Vandaveer Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Like the posts above state, sgen.exe generates a DLL. It will be named [your assembly name].XmlSerializers.dll. Simply delete the dll.

    Once I increased the build verbosity I searched for sgen. In that section it stated that it could not generate [assemly name] because it already existed.
  • Monday, March 30, 2009 2:11 PMGoutam Patari,Pune,India Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Hi Adolfo,

    Thanks a lot.This post is awesome.Its worked for me.I was facing this issue from last couple of days & it was very painful for me.Now i just came out from this problem.The main culprit was XmlSerializers.dll. Thanks again....Cheers..!!


    Best Regards

    Goutam Patari (SE)
    Pune,India
    • Proposed As Answer byJesusLovesU Monday, September 28, 2009 6:02 AM
    •  
  • Monday, September 28, 2009 6:03 AMJesusLovesU Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi All

    The below solutions worked for me. This is the best solution.


    Like the posts above state, sgen.exe generates a DLL. It will be named [your assembly name].XmlSerializers.dll. Simply delete the dll.

    Once I increased the build verbosity I searched for sgen. In that section it stated that it could not generate [assemly name] because it already existed.

  • Wednesday, October 07, 2009 3:30 PMRichardUMG Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The option to turn off serialization assembly generation is available in your project Properties | Compile. Click the "Advanced Compile Options" button. This is true for both VS2005 and VS2008.


    Richard