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);
}
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]); }