I created a library targeting the .net standard 1.4. The library contains my domain model (POCOs). I want to decorate my classes with the MetadataType and the dataannotations attributes. I installed the System.ComponentModel.Annotations but the MetaDataTypeAttribute is absent. I tried to install the Microsoft.Aspnet.Mvc package but is not compatible with .net standard 1.4. Can any body tell me, how can i do to inherit the dataAnnotations defined in my interfaces in a library targeting .net standard 1.4 ? Thanks.
Asked
Active
Viewed 1,976 times
1 Answers
3
MetadataTypeAttribute
- along with BindableTypeAttribute
and ScaffoldTableAttribute
- is not part of any version of .NET Standard (<= 2.0) and also not available on .NET Core so you cannot currently use it in a .NET Standard project and you cannot load a .NET Framework library into .NET Core 2.0 that uses it.

Martin Ullrich
- 94,744
- 25
- 252
- 217
-
I am converting my libraries to .Net Standard 2.0. I have a library that defines a DB table. It has lost the sizing constrains by moving to .Net Standard. I am including the library in a 4.7.2 web app. From the above links it seems that the issue was resolved in Dec 2018. Am I missing something? – Phil Huhn May 02 '19 at 18:56
-
I'm not sure, you may be hitting something else (e.g. missing binding redirects). I suggest creating a project to reproduce your issue (web app + .net standard library) and opening a new question or filing an issue at https://github.com/dotnet/standard – Martin Ullrich May 02 '19 at 19:14