我有一个包含很多.net包的NuGet4.5项目,我把它升级到了4.7.2。为了解决一些包的特定更新问题(比如packages.config中的requireReinstallation="true" ),我升级了相关的包。现在我已经升级了软件包和一些新的软件包,比如
`<package id="System.AppContext" version="4.1.0" targetFramework="net472" />`
........(some other)
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="net472" />目前,我可以构建它,但是当我尝试使用Generate serialization assembly选项来构建它时,我在teamcity (和本地)中得到了一个错误,比如
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当然,我可以禁用Generate serialization assembly,但我不想。我认为问题出在命令行中有太多的参数。在我升级项目后,依赖项的总数达到了限制。
如何解决此问题?breaking down the call to "SGen" into multiple calls with fewer parameters per call (如何解决?)或者其他什么东西
发布于 2018-06-16 07:28:28
我不认为有一个简单的解决方案。sgen不支持RSP文件。
我建议评估命令行(例如,来自msbuild日志)-引用( are )的数量和文件路径长度可能不能很好地协同工作。如果可能,尝试通过使用较少的引用或较短的文件路径来调整项目结构以适应限制(32K字符)。
发布于 2021-04-06 16:11:39
当您在Visual Studio中构建C#项目并得到错误MSB6003时,指定的任务可执行文件"sgen.exe“无法运行。System.ComponentModel.Win32Exception (0x80004005):文件名或扩展名太长您可以通过转到C#项目的属性来修复它,然后在Build选项卡上将Generate serialization assembly设置为off。
将此设置应用于Debug和Release配置,否则它在本地工作(Debug),但在您的生成服务器(Release)上失败。
有关该工具的更多信息,请参见XML序列化程序生成器工具(Sgen.exe)。
https://stackoverflow.com/questions/50871754
复制相似问题