Serge van den Oever's weblog

Fixing "sgen.exe" filename or extension is too long

February 25, 2020 • ☕️ 1 min read

When you build a C# project in Visual Studio and get the error Error MSB6003 The specified task executable "sgen.exe" could not be run. System.ComponentModel.Win32Exception (0x80004005): The filename or extension is too long you can fix it by going to the properties of the C# project, and on the Build tab set the Generate serialization assembly to off.

Apply this setting to both the Debug and Release configuration, otherwise it works locally (Debug), but fails on your build server (Release).

See XML Serializer Generator Tool (Sgen.exe) for more information on the tooling.

Discuss on TwitterEdit on GitHub

Serge van den Oever's weblog

Serge van den Oever

Personal blog by Serge van den Oever - als je maar lol hebt...