How to fix warning MSB3825 due to deprecated BinaryFormatter?

149 Views Asked by At

I have an existing WinForms application. After updating to .NET 8, I now get warnings.

Warning MSB3825 Resource "imageList1.ImageStream" of type "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.

Apparently BinaryFormatter has been deprecated. Okay, fine. I don't even know what it does. But I don't know how to resolve these warnings.

More information is available at https://aka.ms/msbuild/net8-binaryformatter. The recommended action is to "migrate away from BinaryFormatter due to its security and reliability flaws."

But how to do this? I never opted into using this component. The error text appears to indicate it's being used by ImageList. When I search for my program, the only places this symbol shows up is in comments in my resx files! It is WinForms that is referencing this type. So how do I prevent WinForms from referencing it?

0

There are 0 best solutions below