Microsoft.VisualStudio.Project.ProjectNode.SetCurrentConfiguration C# (CSharp) Method

SetCurrentConfiguration() protected method

Set the configuration in MSBuild. This does not get persisted and is used to evaluate msbuild conditions which are based on the $(Configuration) property.
protected SetCurrentConfiguration ( ) : void
return void
        protected internal virtual void SetCurrentConfiguration()
        {
            if (this.BuildInProgress)
            {
                // we are building so this should already be the current configuration
                return;
            }

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

            EnvDTE.Project automationObject = this.GetAutomationObject() as EnvDTE.Project;

            var configKey = ProjectConfig.TryGetActiveConfigurationAndPlatform(ServiceProvider, this);

            //Utilities.GetActiveConfigurationName(automationObject)

            if (configKey != null)
                this.SetConfiguration(configKey);
        }

Usage Example

Esempio n. 1
0
        private MSBuild.BuildProperty GetMsBuildProperty(string propertyName, bool resetCache)
        {
            if (resetCache || this.currentConfig == null)
            {
                // Get properties for current configuration from project file and cache it
                this.project.SetConfiguration(this.ConfigName);
                this.currentConfig = this.project.BuildProject.EvaluatedProperties;

                project.SetCurrentConfiguration();
            }

            if (this.currentConfig == null)
            {
                throw new Exception("Failed to retrieve properties");
            }

            // return property asked for
            return(this.currentConfig[propertyName]);
        }
All Usage Examples Of Microsoft.VisualStudio.Project.ProjectNode::SetCurrentConfiguration
ProjectNode