VsTeXProject.VisualStudio.Project.ProjectNode.SetConfiguration C# (CSharp) Method

SetConfiguration() protected method

Set the configuration property in MSBuild. This does not get persisted and is used to evaluate msbuild conditions which are based on the $(Configuration) property.
protected SetConfiguration ( string config ) : void
config string Configuration name
return void
        protected internal virtual void SetConfiguration(string config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            // Can't ask for the active config until the project is opened, so do nothing in that scenario
            if (!HasProjectOpened)
                return;

            // We cannot change properties during the build so if the config
            // we want to set is the current, we do nothing otherwise we fail.
            if (BuildInProgress)
            {
                var automationObject = GetAutomationObject() as EnvDTE.Project;
                var currentConfigName = Utilities.GetActiveConfigurationName(automationObject);
                var configsAreEqual = string.Compare(currentConfigName, config, StringComparison.OrdinalIgnoreCase) == 0;

                if (configsAreEqual)
                {
                    return;
                }
                throw new InvalidOperationException();
            }

            var propertiesChanged = buildProject.SetGlobalProperty(ProjectFileConstants.Configuration, config);
            if (CurrentConfig == null || propertiesChanged)
            {
                CurrentConfig = buildProject.CreateProjectInstance();
            }

            if (propertiesChanged || designTimeAssemblyResolution == null)
            {
                if (designTimeAssemblyResolution == null)
                {
                    designTimeAssemblyResolution = new DesignTimeAssemblyResolution();
                }

                designTimeAssemblyResolution.Initialize(this);
            }

            options = null;
        }
ProjectNode