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

I write custom rules using the StyleCop SDK. I need to get the name of the visual studio project where the checked element is located. Is there any way to get this?

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

Thanks,

Madhu

+4
source share
1 answer

I got a solution.

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

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

Thanks,

Madhu

+2
source

Source: https://habr.com/ru/post/1333282/


All Articles