StyleCop SDK:如何获取源文档的项目名称

我正在使用StyleCop SDK编写自定义规则.我需要获取checked元素所在的visual studio项目的名称.有没有办法得到这个?

element.Document.SourceCode.Project不提供项目名称.

谢谢,

马杜

最佳答案 我得到了解决方案.

string projectLocation = element.Document.SourceCode.Project.Location;

string projectName = Path.GetFileNameWithoutExtension(projectLocation).Trim();

谢谢,

马杜

点赞