Visual studio не позволяет компилировать "Sgen не может быть запущен"
Получение ошибки:
"The specified task executable "sgen.exe" could not be run. The filename or extension is too long F:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 3408"
И предупреждение:
"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. DAYAnalytics F:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 3408"
В этой части Microsoft.Common.CurrentVersion.targets:
<SGen
BuildAssemblyName="$(TargetFileName)"
BuildAssemblyPath="$(IntermediateOutputPath)"
References="@(ReferencePath)"
ShouldGenerateSerializer="$(SGenShouldGenerateSerializer)"
UseProxyTypes="$(SGenUseProxyTypes)"
UseKeep="$(SGenUseKeep)"
KeyContainer="$(KeyContainerName)"
KeyFile="$(KeyOriginatorFile)"
DelaySign="$(DelaySign)"
ToolPath="$(SGenToolPath)"
SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
EnvironmentVariables="$(SGenEnvironment)"
MSBuildArchitecture="$(SGenMSBuildArchitecture)"
SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"
Platform="$(SGenPlatformTarget)"
Types="$(SGenSerializationTypes)">
Объяснение довольно простое, но я не понимаю, как это исправить. Как мне уменьшить длину командной строки?
1 ответ
Установите для параметра "Создать сборку сериализации" в параметрах сборки значение "Авто" или "Выкл.", Если они не нужны (то есть вы широко используете XmlSerializer), и в этом случае вы найдете дополнительную информацию здесь: Генерация сборка сериализации Xml как часть моей сборки