开发者

StyleCop SDK : How to get the project name of source document

开发者 https://www.devze.com 2023-01-31 21:44 出处:网络
I am writing custom rules using StyleCop SDK. I need to get the name of visual studio project where the checked element resides. Is there any way to get this开发者_运维技巧?

I am writing custom rules using StyleCop SDK. I need to get the name of visual studio project where the checked element resides. Is there any way to get this开发者_运维技巧?

element.Document.SourceCode.Project does not give the project name.

Thanks,

Madhu


I got the solution.

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

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

Thanks,

Madhu

0

精彩评论

暂无评论...
验证码 换一张
取 消