C# 名称空间名称';显示';和';显示属性';找不到
当我试图编译我的.Dll时,我已经设法解决了我所有的引用和错误,除了这两个(我有多个) “找不到类型或命名空间名称‘Display’(是否缺少using指令或程序集引用?)” “找不到类型或命名空间名称'DisplayAttribute'(是否缺少using指令或程序集引用?)” 我正在使用System.ComponentModel和System.ComponentModel.DataAnnotations。原谅我,因为我对这一切都很模糊,我只是对这个项目做一个小的改变。我不明白我错过了什么参考资料导致了这些错误,我也确信这个问题是由我的经验不足造成的。非常感谢您的帮助,谢谢 代码的一小部分:C# 名称空间名称';显示';和';显示属性';找不到,c#,reference,.net-assembly,displayattribute,C#,Reference,.net Assembly,Displayattribute,当我试图编译我的.Dll时,我已经设法解决了我所有的引用和错误,除了这两个(我有多个) “找不到类型或命名空间名称‘Display’(是否缺少using指令或程序集引用?)” “找不到类型或命名空间名称'DisplayAttribute'(是否缺少using指令或程序集引用?)” 我正在使用System.ComponentModel和System.ComponentModel.DataAnnotations。原谅我,因为我对这一切都很模糊,我只是对这个项目做一个小的改变。我不明白我错过了什么参考
using PatientTracker.Entities.Validation;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
namespace PatientTracker.Entities
{
[Serializable]
public abstract class EntityBaseCore : IEntity, INotifyPropertyChanged, IDataErrorInfo, IDeserializationCallback, INotifyPropertyChanging
{
[Display(AutoGenerateField = false)]
[NonSerialized]
protected bool bindingIsNew = true;
[Display(AutoGenerateField = false)]
[NonSerialized]
private bool isEntityTracked;
[Display(AutoGenerateField = false)]
[NonSerialized]
private bool suppressEntityEvents;
private string entityHashCode;
[NonSerialized]
private object tag;
[NonSerialized]
private ValidationRules _validationRules;
[Display(AutoGenerateField = false)]
public abstract string TableName { get; }
[Display(AutoGenerateField = false)]
public abstract string[] TableColumns { get; }
[Browsable(false)]
[Display(AutoGenerateField = false)]
public virtual bool IsDeleted
{
get
{
return this.EntityState == EntityState.Deleted;
}
}
我在display上单击鼠标右键并使用上面给出的使用程序集名称的resolve,效果很好。删除和添加程序集未完成 您可以显示导致这些错误的代码吗?我可以显示一小部分,这应该足够了。注意:我也没有对此代码进行任何更改。您很可能缺少对
System.ComponentModel.DataAnnotations.dll
assembly的引用。右键单击解决方案资源管理器中的References
节点,选择addreference…
,选择Assemblies
选项卡,在列表中找到System.ComponentModel.DataAnnotations.dll
程序集,并确保选中它。重新编译。很有趣。。因此,System.ComponentModel.DataAnnotations在我的参考文献中,但为了一致性,根据您的建议,我删除了它,并再次将其添加为参考文献。现在它上面有一个黄色感叹号,当我尝试重新编译时,我还有236个错误。。很明显,这里有些不对劲。