本文整理汇总了C#中IDeclaredElement.GetProjectFiles方法的典型用法代码示例。如果您正苦于以下问题:C# IDeclaredElement.GetProjectFiles方法的具体用法?C# IDeclaredElement.GetProjectFiles怎么用?C# IDeclaredElement.GetProjectFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDeclaredElement
的用法示例。
在下文中一共展示了IDeclaredElement.GetProjectFiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyProjectReference
private void VerifyProjectReference(INamedTag classTag, IDeclaredElement typeElement) {
Logger.LogMessage("VerifyProjectReference");
// TODO: verify if this logic works if the mapped class is references as an assembly instead of a project
if ((classTag == null) || (typeElement == null)) {
Logger.LogMessage("classtag {0}, typeElement {1}", classTag, typeElement);
return;
}
IProject projectOfMappings = classTag.GetProject();
if (projectOfMappings == null) {
Logger.LogMessage("Project of mapping not found");
return;
}
Logger.LogMessage("ProjectOfMappings {0}", projectOfMappings.Name);
foreach (IProjectFile projectFile in typeElement.GetProjectFiles()) {
Logger.LogMessage("Project {0}", projectFile.GetProject().Name);
if (projectFile.GetProject() == projectOfMappings) {
Logger.LogMessage("Type is defined in same project");
return;
}
foreach (IProjectReference projectReference in classTag.GetProject().GetProjectReferences()) {
Logger.LogMessage("Project reference {0}", projectReference.ResolveReferencedProject().Name);
if (projectReference.ResolveReferencedProject() == projectFile.GetProject()) {
return;
}
}
}
IElement typeElementTag = classTag.GetNameAttribute();
AddHighlighting(typeElementTag, new ReferenceHighlighting(string.Format("Mapping project '{0}' should reference project '{1}'",
projectOfMappings.Name, typeElement.GetProjectFiles()[0].GetProject().Name)));
}