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

            SolutionEntityItem eitem = item as SolutionEntityItem;

            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.GetAllSolutionItems <SolutionEntityItem> ())
                        {
                            sconf.AddItem(it);
                        }
                        ParentSolution.Configurations.Add(sconf);
                    }
                }
            }
        }
        IEnumerable <DotNetProject> GetReferencingProjects()
        {
            if (ParentSolution == null)
            {
                return(new DotNetProject[0]);
            }

            return(ParentSolution.GetAllSolutionItems <DotNetProject> ().Where(p => p.References.Any(r => r.GetItemsProjectPath() != null)));
        }
        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.GetAllSolutionItems <DotNetProject> ())
            {
                ProcessProject(p);
            }
        }