How to get the Project Name from a custom Workflow Analyzer rule?
Resolution
- IProjectPropertiesService was added in Studio 2022.4 to the UiPath.Activities.API SDK and returns the project name
- Set up Visual Studio to point to services for downloading packages
- Use the code example below to get the Project Name. It is available through the Iprojectsummary arg1. Using IProjectModel, should also be an alternative to IProjectSummary.
internal static class ProjectDisplayName
{
private const string RuleId = "ST-TEST-001";
internal static Rule Get()
{
var rule = new Rule("Project Name", RuleId, Inspect)
{
RecommendationMessage = Recommendation,
ErrorLevel = System.Diagnostics.TraceLevel.Warning
};
return rule;
}
private static InspectionResult Inspect(
IProjectSummary arg1,
UiPath.Studio.Activities.Api.Analyzer.Rules.Rule arg2)
{
var ProjectName = arg1.DisplayName;
return new InspectionResult()
;
}
}