I have .NET Standard 2.1 class library, which includes an object-model with properties attributed with DataAnnotations. I'm consuming it from a v3 Azure Function targeting .NET Core 3.1. I'm able to use the library no problem from a .NET Core console app, but when I consume it from the Azure Function app I get this error at runtime:
System.Private.CoreLib: Exception while executing function: ... System.Private.CoreLib: Could not load file or assembly 'System.ComponentModel.Annotations, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Interestingly, I don't get this error when populating the object-model, only when trying to serialize it to JSON.
I've tried adding the System.ComponentModel.Annotations nuget package to the functions project as well, and tried suggested fixes for similar issues such as https://stackoverflow.com/a/44079161/892770 and https://stackoverflow.com/a/50776946/892770 to no avail.
Any ideas? Thanks!