ASP.NET sgen.exe fails during build

Uwe Domschke 1 Reputation point
2024-01-15T12:22:04.36+00:00

I have a Web site with ASP.NET in VS 2022. When I add a web service reference I get an error on publishing: "sgen.exe" ended with Code 1.
In the internet I found the solution: "Go to the project properties and click on the Build tab and set the value of the "Generate Serialization Assembly" dropdown to "Off".
But this brings nothing to me. When I delete the web service reference it works. What else can I do?

Developer technologies ASP.NET Other
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 30,186 Reputation points Microsoft External Staff
    2024-01-16T02:32:48.14+00:00

    Hi @Uwe Domschke,

    In the internet I found the solution: "Go to the project properties and click on the Build tab and set the value of the "Generate Serialization Assembly" dropdown to "Off".

    Have you tried rebuilding the project after performing this step? Maybe you could try setting the value of the "Generate Serialization Assembly" dropdown to "Off" and re-add the web service reference. User's image

    Or try disabling it again in the project file:

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
                    :
        <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
                    :
    </PropertyGroup>
    
    
    

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.