Microsoft.VisualStudio.Project.ConfigProvider.DeleteCfgsOfCfgName C# (CSharp) Method

DeleteCfgsOfCfgName() public method

Deletes a specified configuration name.
public DeleteCfgsOfCfgName ( string name ) : int
name string The name of the configuration to be deleted.
return int
        public virtual int DeleteCfgsOfCfgName(string name)
        {
            if (name == null)
                throw new ArgumentNullException("name");
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("name cannot be null or empty");

            // We need to QE/QS the project file
            if(!this.ProjectManager.QueryEditProjectFile(false))
            {
                throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
            }

            // Verify that this configuration exists
            string[] configs = GetPropertiesConditionedOn(ProjectFileConstants.Configuration);
            if (!configs.Contains(name, StringComparer.OrdinalIgnoreCase))
                return VSConstants.S_OK;

            foreach (MSBuild.Project project in GetBuildProjects(true))
            {
                int hr = DeleteConfiguration(project, name);
                if (ErrorHandler.Failed(hr))
                    return hr;
            }

            NotifyOnCfgNameDeleted(name);
            return VSConstants.S_OK;
        }