The "GenerateBindingRedirects" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both are too long.
The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at System.IO.PathHelper.GetFullPathName()
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
at System.Xml.XmlWriterSettings.CreateWriter(String outputFileName)
at System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings)
at System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options)
at Microsoft.Build.Tasks.GenerateBindingRedirects.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() Incryptex.OMS.Workflow.MarketData.Service
Easiest solution is to:
.csproj
file of the project that's giving you the issue.Add this at the end of the .csproj
file
<Target Name="WorkaroundAppConfigPathTooLong"
BeforeTargets="GenerateBindingRedirects">
<PropertyGroup>
<_GenerateBindingRedirectsIntermediateAppConfig>$(IntermediateOutputPath)$(TargetFileName).config</_GenerateBindingRedirectsIntermediateAppConfig>
</PropertyGroup>
</Target>
Save and reload the project. Rebuild.
You're basically asking Visual Studio to cut down the path length of the intermediate app config file that's giving you the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With