public void Build(
            XDocument doc, ITextSource textSource,
            MSBuildParserContext context)
        {
            var project = doc.Nodes.OfType <XElement> ().FirstOrDefault(x => x.Name == xnProject);

            if (project == null)
            {
                //TODO: error
                return;
            }

            var sdks = ResolveSdks(context, project).ToList();

            var pel = MSBuildLanguageElement.Get("Project");

            GetPropertiesToTrack(context.PropertyCollector, project);

            var importResolver = context.CreateImportResolver(Filename);

            AddSdkProps(sdks, context.PropertyCollector, importResolver);

            var resolver = new MSBuildSchemaBuilder(IsToplevel, context, importResolver);

            resolver.Run(doc, textSource, this);

            AddSdkTargets(sdks, context.PropertyCollector, importResolver);
        }
        void ResolveImports(MSBuildProjectElement project, MSBuildParserContext context)
        {
            var sdks = ResolveSdks(project, context).ToList();

            //tag the properties we need to track for the imports
            GetPropertiesToTrack(context.PropertyCollector, project);

            var importResolver = context.CreateImportResolver(Filename);

            AddSdkProps(sdks, context.PropertyCollector, importResolver);

            void ExtractProperties(MSBuildPropertyGroupElement pg)
            {
                foreach (var prop in pg.Elements)
                {
                    context.PropertyCollector.Collect(prop.ElementName, prop.Value);
                }
            }

            foreach (var el in project.Elements)
            {
                switch (el)
                {
                case MSBuildPropertyGroupElement pg:
                    ExtractProperties(pg);
                    break;

                case MSBuildChooseElement choose:
                    foreach (var c in choose.Elements)
                    {
                        foreach (var pg in c.GetElements <MSBuildPropertyGroupElement> ())
                        {
                            ExtractProperties(pg);
                        }
                    }
                    break;

                case MSBuildImportElement imp:
                    ResolveImport(imp, context, importResolver);
                    break;
                }
            }

            AddSdkTargets(sdks, context.PropertyCollector, importResolver);
        }