Esempio n. 1
0
        private void AnalyzePropertiesAndItems(BoundSourceFileBuilder binder, IXmlElement parent)
        {
            foreach (var group in parent.Elements("PropertyGroup"))
            {
                binder.AddReferences(group.Attribute("Condition").GetAttributeValueExpressionSpans());
                foreach (var element in group.Elements)
                {
                    binder.AddElementNameReferences(element,
                                                    CreatePropertyReference(element.Name));

                    ExpressionProcessor propertyValueProcessor = null;
                    if (element.Name.EndsWith("DependsOn"))
                    {
                        propertyValueProcessor = ProcessSemicolonSeparatedTargetList;
                    }

                    binder.AddReferences(element.Attribute("Condition").GetAttributeValueExpressionSpans());
                    binder.AddReferences(element.GetElementValueExpressionSpans(propertyValueProcessor));
                }
            }

            foreach (var group in parent.Elements("ItemGroup"))
            {
                AnalyzeItemGroup(binder, group);
            }

            foreach (var group in parent.Elements("ItemDefinitionGroup"))
            {
                AnalyzeItemGroup(binder, group, isDefinition: true);
            }
        }
Esempio n. 2
0
        private void AnalyzeItemGroup(BoundSourceFileBuilder binder, IXmlElement group, bool isDefinition = false)
        {
            binder.AddReferences(group.Attribute("Condition").GetAttributeValueExpressionSpans());
            foreach (var element in group.Elements)
            {
                var itemName = element.Name;
                binder.AddElementNameReferences(element,
                                                CreateItemReference(itemName));

                binder.AddReferences(element.Attribute("Condition").GetAttributeValueExpressionSpans(referencingItemName: itemName));
                binder.AddReferences(element.Attribute("Include").GetAttributeValueExpressionSpans());
                binder.AddReferences(element.Attribute("Exclude").GetAttributeValueExpressionSpans());
                binder.AddReferences(element.Attribute("Remove").GetAttributeValueExpressionSpans());

                foreach (var metadataElement in element.Elements)
                {
                    binder.AddReferences(metadataElement.Attribute("Condition").GetAttributeValueExpressionSpans(referencingItemName: itemName));
                    binder.AddElementNameReferences(metadataElement,
                                                    CreateItemMetadataReference(element.Name, metadataElement.Name));

                    binder.AddReferences(metadataElement.GetElementValueExpressionSpans(referencingItemName: itemName));
                }
            }
        }