Esempio n. 1
0
        void Initialize(Project parent)
        {
            dir_path         = Directory.GetCurrentDirectory();
            raw_imports      = new List <ResolvedImport> ();
            item_definitions = new Dictionary <string, ProjectItemDefinition> ();
            targets          = new Dictionary <string, ProjectTargetInstance> ();
            raw_items        = new List <ProjectItem> ();

            // FIXME: this is likely hack. Test ImportedProject.Properties to see what exactly should happen.
            if (parent != null)
            {
                properties = parent.properties;
            }
            else
            {
                properties = new List <ProjectProperty> ();

                foreach (DictionaryEntry p in Environment.GetEnvironmentVariables())
                {
                    // FIXME: this is kind of workaround for unavoidable issue that PLATFORM=* is actually given
                    // on some platforms and that prevents setting default "PLATFORM=AnyCPU" property.
                    if (!string.Equals("PLATFORM", (string)p.Key, StringComparison.OrdinalIgnoreCase))
                    {
                        this.properties.Add(new EnvironmentProjectProperty(this, (string)p.Key, (string)p.Value));
                    }
                }
                foreach (var p in GlobalProperties)
                {
                    this.properties.Add(new GlobalProjectProperty(this, p.Key, p.Value));
                }
                var tools = ProjectCollection.GetToolset(this.ToolsVersion) ?? ProjectCollection.GetToolset(this.ProjectCollection.DefaultToolsVersion);
                foreach (var p in ProjectCollection.GetReservedProperties(tools, this))
                {
                    this.properties.Add(p);
                }
                foreach (var p in ProjectCollection.GetWellKnownProperties(this))
                {
                    this.properties.Add(p);
                }
            }

            ProcessXml(parent);

            ProjectCollection.AddProject(this);
        }