BinaryFormatter serialization of custom BuildEventArgs and ITaskItems removed for .NET 7
MSBuild in .NET 7 doesn't support serialization of custom
ITaskItem-derived types via the
MSBuild 17.4 (.NET SDK 7.0.100)
MSBuild used BinaryFormatter to preserve custom types that derived from BuildEventArgs and ITaskItem across certain boundaries, most notably when running in a multi-process environment.
MSBuild will no longer support this mechanism, so code that used custom types derived from BuildEventArgs and ITaskItem may fail.
Reason for change
BinaryFormatter was made obsolete in .NET 5. Per this plan, all first-party code in the dotnet GitHub organization must migrate away from its use by .NET 7. This change impacts user-exposed functionality of MSBuild.
Engage with the MSBuild team on this GitHub discussion about your specific use cases and how you can migrate away from the
Avoid returning custom derived types from tasks or when logging.
Submit and view feedback for