Example #1
0
        public void AddItem(SolutionFolderItem item, bool createSolutionConfigurations)
        {
            Items.Add(item);

            SolutionItem eitem = item as SolutionItem;

            if (eitem != null && createSolutionConfigurations && eitem.SupportsBuild())
            {
                // Create new solution configurations for item configurations
                foreach (ItemConfiguration iconf in eitem.Configurations)
                {
                    bool found = false;
                    foreach (SolutionConfiguration conf in ParentSolution.Configurations)
                    {
                        if (conf.Name == iconf.Name && (iconf.Platform == conf.Platform || iconf.Platform.Length == 0))
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        SolutionConfiguration sconf = new SolutionConfiguration(iconf.Id);
                        // Add all items to the new configuration
                        foreach (var it in ParentSolution.GetAllItems <SolutionItem> ())
                        {
                            sconf.AddItem(it);
                        }
                        ParentSolution.Configurations.Add(sconf);
                    }
                }
            }
        }
Example #2
0
        IEnumerable <DotNetProject> GetReferencingProjects()
        {
            if (ParentSolution == null)
            {
                return(new DotNetProject[0]);
            }

            return(ParentSolution.GetAllItems <DotNetProject> ().Where(p => p.References.Any(r => r.GetItemsProjectPath() != null)));
        }
Example #3
0
        protected override void OnBoundToSolution()
        {
            if (currentSolution != null)
            {
                DisconnectFromSolution();
            }

            base.OnBoundToSolution();

            ParentSolution.ReferenceAddedToProject     += HandleReferenceAddedToProject;
            ParentSolution.ReferenceRemovedFromProject += HandleReferenceRemovedFromProject;
            ParentSolution.SolutionItemAdded           += HandleSolutionItemAdded;
            currentSolution = ParentSolution;

            // Maybe there is a project that is already referencing this one. It may happen when creating a solution
            // from a template
            foreach (var p in ParentSolution.GetAllItems <DotNetProject> ())
            {
                ProcessProject(p);
            }
        }