I have a .net 4.5 project with a lot of nuget packages and I upgraded it to 4.7.2. To resolve some specific update problems with packages(like requireReinstallation="true" in packages.config) I upgraded related packages. Now I have upgraded packages and some new packages like
`<package id="System.AppContext" version="4.1.0" targetFramework="net472" />`
........(some other)
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="net472" />
At this moment, I can build it, but when I try to do it with Generate serialization assembly option I got an error in teamcity (and locally) like
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\sgen.exe /assembly:C:\buildAgent\work\6b1c1da90609c252\Site\obj\TeamCity\Site.dll /proxytypes
/reference:C:\buildAgent\work\6b1c1da90609c252\packages\AjaxMin.4.48.4489.28432\lib\net20\AjaxMin.dll
[SGen] C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3463, 5): warning MSB6002: The command-line for the "SGen" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "SGen" into multiple calls with fewer parameters per call.
[SGen] C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(3463, 5): error MSB6003: The specified task executable "sgen.exe" could not be run. The filename or extension is too long
Of course I can disable Generate serialization assembly but I don't want.
I think the problem in too big amount of arguments in command line. After I upgraded the project the total amount of dependencies reached the limit.
How can I resolve this issue? breaking down the call to "SGen" into multiple calls with fewer parameters per call (how?) or something else
I don't think there is a simple solution. sgen does not support RSP files.
I would suggest to evaluate the command line (e.g. from msbuild logs) - the number of references (args) and file path lengths are likely not working well together. Try to restructure your project to fit into the limits (32K chars) by using less references or using shorter file path if possible.