Example #1
0
        public bool TryGetProjectRuleSetFilePath(Project project, RuleSetDeclaration declaration, out string fullFilePath)
        {
            List <string> options = new List <string>();

            options.Add(declaration.RuleSetPath);                                                   // Might be a full path
            options.Add(PathHelper.ResolveRelativePath(declaration.RuleSetPath, project.FullName)); // Relative to project
            // Note: currently we don't search in rule set directories since we expect the project rule set
            // to be relative to the project. We can add this in the future if it will be needed.

            IFileSystem fileSystem = this.serviceProvider.GetService <IFileSystem>();

            fileSystem.AssertLocalServiceIsNotNull();

            fullFilePath = options.FirstOrDefault(fileSystem.FileExist);

            return(!string.IsNullOrWhiteSpace(fullFilePath));
        }