private AttributeListSyntax CreateInternalVisibleToAttributeList(Project project, Project[] allProjects) { var testProjects = allProjects.Where(x => x.ProjectReferences.Any(y => y.ProjectId == project.Id)).ToArray(); if (testProjects.Length == 0) return null; List<AttributeSyntax> attrs = testProjects.Select(CreateInternalVisibleToAttribute).ToList(); var attributeList = new SeparatedSyntaxList<AttributeSyntax>(); attributeList = attributeList.AddRange(attrs); var assemblyLevelSpecifier = SyntaxFactory.AttributeTargetSpecifier(SyntaxFactory.Token(SyntaxKind.AssemblyKeyword)); return SyntaxFactory.AttributeList(assemblyLevelSpecifier, attributeList); }