Example #1
0
        public ProjectConfig(ProjectNode project, string configuration)
        {
            this.project    = project;
            this.configName = configuration;

            // Initialize output groups

            // Get the list of group names from the project.
            // The main reason we get it from the project is to make it easier for someone to modify
            // it by simply overriding that method and providing the correct MSBuild target(s).
            IList <KeyValuePair <string, string> > groupNames = project.GetOutputGroupNames();

            if (groupNames != null)
            {
                // Populate the output array
                foreach (KeyValuePair <string, string> group in groupNames)
                {
                    OutputGroup outputGroup = CreateOutputGroup(project, group);
                    this.outputGroups.Add(outputGroup);
                }
            }

            // Because the project can be aggregated by a flavor, we need to make sure
            // we get the outer most implementation of that interface (hence: project --> IUnknown --> Interface)
            IntPtr projectUnknown = Marshal.GetIUnknownForObject(this.ProjectMgr);

            try
            {
                IVsProjectFlavorCfgProvider flavorCfgProvider = (IVsProjectFlavorCfgProvider)Marshal.GetTypedObjectForIUnknown(projectUnknown, typeof(IVsProjectFlavorCfgProvider));
                ErrorHandler.ThrowOnFailure(flavorCfgProvider.CreateProjectFlavorCfg(this, out flavoredCfg));
                if (flavoredCfg == null)
                {
                    throw new COMException();
                }
            }
            finally
            {
                if (projectUnknown != IntPtr.Zero)
                {
                    Marshal.Release(projectUnknown);
                }
            }
            // if the flavored object support XML fragment, initialize it
            if (flavoredCfg is IPersistXMLFragment)
            {
                this.project.LoadXmlFragment((IPersistXMLFragment)flavoredCfg, this.DisplayName);
            }
        }
Example #2
0
 protected virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair<string, string> group)
 {
     OutputGroup outputGroup = new OutputGroup(group.Key, group.Value, project, this);
     return outputGroup;
 }
Example #3
0
        protected virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair <string, string> group)
        {
            OutputGroup outputGroup = new OutputGroup(group.Key, group.Value, project, this);

            return(outputGroup);
        }