在我的代码库中,我有一个在基类中定义的方法,该基类被继承,但该方法尚未被覆盖。很可能将来会覆盖此方法以添加到基本实现中。
我的设置看起来像这样:
我的设置看起来像这样:
public abstract class BaseFoo
{
public virtual void Bar()
{
//default implementation
}
}
public class RealFoo : BaseFoo
{
//extra code, does *NOT YET* override Bar but might in the future
}
public class DependentClass
{
/// <summary>
/// Uses <see cref="RealFoo.Bar"/> to do some magic
/// </summary>
public void SomeMethod()
{
}
}
由于Bar很有可能会在未来被覆盖,我希望将我的xmldoc未来证明并引用RealFoo.Bar而不是BaseFoo.Bar。
当我在代码中调用RealFoo.Bar()时,不会出现任何错误。但是当我在cref属性中这样做时,会收到以下警告:
警告 CS1574 XML注释具有无法解析的cref属性'Bar'。
这里我做错了什么,还是cref的限制?
我正在使用Visual Studio 2017,目标为netstandard2.0和net452,并在我的csproj中启用了XML文档。