Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在.net core 1.0中使用数据批注_C#_Visual Studio 2015_Data Annotations_.net Core - Fatal编程技术网

C# 无法在.net core 1.0中使用数据批注

C# 无法在.net core 1.0中使用数据批注,c#,visual-studio-2015,data-annotations,.net-core,C#,Visual Studio 2015,Data Annotations,.net Core,就像早期的beta版(dnx)一样,我正在尝试将代码移植到.net core 1.0 rtm,代码在以下单元上进行回复,其中包含ValidationAttribute类型和其他内容: using System.ComponentModel.DataAnnotations; namespace Hl7.Fhir.Introspection { [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultip

就像早期的beta版(dnx)一样,我正在尝试将代码移植到.net core 1.0 rtm,代码在以下单元上进行回复,其中包含ValidationAttribute类型和其他内容:

using System.ComponentModel.DataAnnotations;

namespace Hl7.Fhir.Introspection
{
    [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
    public sealed class FhirElementAttribute : ValidationAttribute
    ...
如何将此类代码移植到dotnet core 1.0 rtm?

我使用非官方代码在新的Microsoft开源软件包中搜索类

您正在包中查找
System.Runtime.AttributeUsageAttribute
。它适用于
.NET标准1.0
及更高版本

编辑:
很抱歉你问的是
ValidationAttribute
,不是
AttributeUsage
,我的错。反向软件包指向,

一些早期测试日建议将单元名称更改为System.ComponentModel.Annotations,但这不起作用。您尝试过吗?哦,这是预发布的位,但不是dotnet-RC2级位Hooops。。。我的错:)应该是你要找的人谢谢。节省了我很多时间。