Пример #1
0
        public String[] FindConfigs(String project, String platform)
        {
            String[] entries  = null;
            int      actCount = 0;

            IEnumerator e = GetVCProjectRefs();

            e.Reset();
            while (e.MoveNext())
            {
                VCProject actVCP = (VCProject)e.Current;
                if (actVCP.Name == project)
                {
                    IVCCollection configs = (IVCCollection)actVCP.Configurations;
                    entries = new String[configs.Count];
                    IEnumerator eConfs = configs.GetEnumerator();
                    eConfs.Reset();
                    while (eConfs.MoveNext())
                    {
                        String actEntry = ((VCConfiguration)eConfs.Current).Name;
                        // configuration name comes in the form "Debug|Win32"
                        actEntry            = actEntry.Substring(0, actEntry.IndexOf("|"));
                        entries[actCount++] = actEntry;
                    }
                }
            }
            return(entries);
        }
Пример #2
0
        private IEnumerator GetVCProjectRefs()
        {
            IVCCollection projects = null;

            // we must use this way around, since the projects collection from the applicationObject does not work
            // Google News says this is a confirmed VS bug
            for (int i = 1; i < 2; i++)
            {
                try
                {
                    VCProject vcP = (VCProject)_applicationObject.Solution.Item(i).Object;
                    if (vcP != null)
                    {
                        VCProjectEngine projEngine = (VCProjectEngine)vcP.VCProjectEngine;
                        if (projEngine != null)
                        {
                            projects = (IVCCollection)projEngine.Projects;
                            if (projects != null)
                            {
                                break;
                            }
                            else
                            {
                                Debug(String.Format("Reading item {0} not possible, projects==null", i));
                            }
                        }
                        else
                        {
                            Debug(String.Format("Reading item {0} not possible, projEngine==null", i));
                        }
                    }
                    else
                    {
                        Debug(String.Format("Reading item {0} not possible, vcP==null", i));
                    }
                }
                catch (Exception e)
                {
                    Debug(String.Format("Reading item {0} not possible", i));
                    Debug(e);
                }
            }
            return(projects.GetEnumerator());
        }