SolutionConfigurationEntry CreateDefaultMapping(SolutionEntityItem item)
        {
            var conf  = GetSelectedConfiguration(item);
            var entry = configuration.AddItem(item);

            entry.ItemConfiguration = conf;
            return(entry);
        }
        public ItemConfiguration AddConfiguration(string name, string sourceName, bool createChildConfigurations)
        {
            ItemConfiguration conf = entry.CreateConfiguration(name);

            if (sourceName != null)
            {
                ItemConfiguration sc = configurations [sourceName];
                if (sc != null)
                {
                    conf.CopyFrom(sc);
                }
                else
                {
                    sourceName = null;
                }
            }

            if (entry is Solution)
            {
                SolutionConfiguration cc = (SolutionConfiguration)conf;
                foreach (ConfigurationData data in children)
                {
                    SolutionConfigurationEntry ce;
                    if (sourceName != null)
                    {
                        ce = cc.GetEntryForItem((SolutionEntityItem)data.Entry);
                    }
                    else
                    {
                        ce = cc.AddItem((SolutionEntityItem)data.Entry);
                    }
                    if (createChildConfigurations)
                    {
                        ce.ItemConfiguration = name;
                        if (data.Configurations [name] == null)
                        {
                            data.AddConfiguration(name, sourceName, createChildConfigurations);
                        }
                    }
                    else if (sourceName == null)
                    {
                        if (data.Configurations.Count > 0)
                        {
                            ce.ItemConfiguration = data.Configurations [0].Id;
                        }
                    }
                }
            }

            configurations.Add(conf);
            if (ConfigurationsChanged != null)
            {
                ConfigurationsChanged(this, null);
            }
            return(conf);
        }
 public static void GenerateDefaultDnxProjectConfigurations(this Solution solution, DnxProject project)
 {
     foreach (SolutionItemConfiguration configuration in project.Configurations)
     {
         SolutionConfiguration existingConfiguration = solution.GetConfiguration(configuration);
         if (existingConfiguration == null)
         {
             SolutionConfiguration newConfiguration = solution.AddConfiguration(configuration.Name, false);
             newConfiguration.AddItem(project);
         }
     }
 }
Example #4
0
        internal void AddProjectAndSolutionConfiguration(DubProjectConfiguration cfg)
        {        //TODO: Is an other config with the same id already existing?
            if (ParentSolution != null)
            {
                var slnCfg = new SolutionConfiguration(cfg.Name, cfg.Platform);
                ParentSolution.Configurations.Add(slnCfg);
                slnCfg.AddItem(this).Build = true;
            }
            Configurations.Add(cfg);

            if (Configurations.Count == 1)
            {
                DefaultConfigurationId = cfg.Id;
            }
        }
Example #5
0
        public void AddProjectAndSolutionConfiguration(DubProjectConfiguration cfg)
        {
            if (ParentSolution != null)
            {
                var slnCfg = new SolutionConfiguration(cfg.Name, cfg.Platform);
                ParentSolution.Configurations.Add(slnCfg);
                slnCfg.AddItem(this).Build = true;
            }
            Configurations.Add(cfg);

            if (Configurations.Count == 1)
            {
                DefaultConfigurationId = cfg.Id;
            }
        }
Example #6
0
        /* Gets the CombineConfigurationEntry corresponding to the @entry in its parentCombine's
         * CombineConfiguration. Creates the required bits if not present */
        SolutionConfigurationEntry GetConfigEntry(Solution sol, SolutionItem item, string configName)
        {
            configName = FromSlnConfigurationId(configName);

            SolutionConfiguration solutionConfig = sol.Configurations [configName];

            if (solutionConfig == null)
            {
                solutionConfig = CreateSolutionConfigurationFromId(configName);
                sol.Configurations.Add(solutionConfig);
            }

            SolutionConfigurationEntry conf = solutionConfig.GetEntryForItem(item);

            if (conf != null)
            {
                return(conf);
            }
            return(solutionConfig.AddItem(item));
        }