20

.NET Standard did not support 'System.ComponentModel.DataAnnotations', and 'System.Type.Properties', how to keep compatible with it ?

coffeedrunk
  • 203
  • 1
  • 2
  • 5

1 Answers1

34

The types from the System.ComponentModel.DataAnnotations namespace are in the System.ComponentModel.Annotations package, which is not installed by default in a .Net Standard library, so you need to install it manually to use it there.

If you mean Type.GetProperties(), then that method exists as an extension method in .Net Core and in .Net Standard. In a .Net Standard library, you will need to install the System.Reflection.TypeExtensions package. In both a .Net Core application and a .Net Standard library, you will need to add using System.Reflection; to your source.

svick
  • 236,525
  • 50
  • 385
  • 514