Le réseau pour les développeurs > Forums - Accueil > MSBuild > "sgen.exe" exited with code 1
Poser une questionPoser une question
 

Traitée"sgen.exe" exited with code 1

  • mercredi 28 décembre 2005 23:21birch9397 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

Réponses

Toutes les réponses

  • jeudi 29 décembre 2005 17:31Faisal Mohamood MSFTModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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

  • jeudi 29 décembre 2005 17:39birch9397 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

     

  • jeudi 29 décembre 2005 18:21Sayed Ibrahim HashimiModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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
  • jeudi 29 décembre 2005 18:22birch9397 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    Thanks. I'm still getting used to the VS 2005. I'll give it a try.
  • mardi 3 janvier 2006 19:13Mahesh_ChandramouliModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    Hi,

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

     

     

     

  • mardi 3 janvier 2006 19:15Sayed Ibrahim HashimiModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    Can you insert the relevant portions of the log here?

    Sayed Ibrahim Hashimi
    www.sedodream.com
  • mardi 3 janvier 2006 19:47Mahesh_ChandramouliModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

  • mardi 3 janvier 2006 19:49birch9397 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     Traitée
    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.
  • mardi 3 janvier 2006 20:11Mahesh_ChandramouliModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

     

  • mardi 3 janvier 2006 20:13birch9397 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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.
  • mercredi 4 janvier 2006 17:32Neil Enns MSFTModérateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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

  • mercredi 4 janvier 2006 18:12birch9397 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.)

  • dimanche 8 janvier 2006 18:18AntoninoCrudele Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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

     

  • vendredi 20 janvier 2006 15:20Shawn Hubbard Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

  • vendredi 20 janvier 2006 23:39Noah Nadeau Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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...
  • lundi 23 janvier 2006 20:27birch9397 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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?
  • vendredi 27 janvier 2006 16:47Shawn Trevellick Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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?

  • vendredi 27 janvier 2006 17:19Noah Nadeau Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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.
  • vendredi 17 février 2006 11:01CARPe Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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

  • vendredi 24 février 2006 03:07RicardoPretrazey Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

  • mercredi 28 juin 2006 13:37david wendelken Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

     

    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!

  • mercredi 30 août 2006 15:41Colin BowernMVPMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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
  • lundi 25 septembre 2006 08:29riz332 Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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

  • vendredi 6 octobre 2006 18:06msauper Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

  • lundi 30 octobre 2006 23:41Stefan Dobrev Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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

  • mardi 13 février 2007 18:13raymondbrady Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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.
  • mercredi 28 mars 2007 16:02Diego Jancic Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
  • vendredi 22 juin 2007 13:37Ans Vlug Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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' ">
  • lundi 25 juin 2007 11:35Tigraine Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

     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

  • mercredi 8 août 2007 11:13RaviGoli Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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"
  • lundi 13 août 2007 18:56FcoLomas Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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??
  • jeudi 15 novembre 2007 15:59JKuzhi Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    Do Clean Solution and Rebuild the Solution.

  • dimanche 6 janvier 2008 12:50Taha Amin Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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

  • mercredi 16 janvier 2008 17:38Rashad Rivera Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     Réponse proposée

    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

     

  • vendredi 15 février 2008 09:20ndu Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

  • mardi 20 mai 2008 18:51CLaucher Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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

  • mercredi 16 juillet 2008 17:40DanielWilson Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    >>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.
  • mercredi 1 octobre 2008 10:10Hervé Soulié Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     Réponse proposée
    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é

  • jeudi 6 novembre 2008 14:53R L Vandaveer Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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.
  • lundi 30 mars 2009 14:11Goutam Patari,Pune,India Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     Réponse proposée
    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
    • Proposé comme réponseJesusLovesU lundi 28 septembre 2009 06:02
    •  
  • lundi 28 septembre 2009 06:03JesusLovesU Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    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.

  • mercredi 7 octobre 2009 15:30RichardUMG Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    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