private MSBuildExecution.ProjectPropertyInstance GetMsBuildProperty(string propertyName, bool resetCache)
{
if (resetCache || currentConfig == null)
{
// Get properties for current configuration from project file and cache it
ProjectMgr.SetConfiguration(ConfigName);
ProjectMgr.BuildProject.ReevaluateIfNecessary();
// Create a snapshot of the evaluated project in its current state
currentConfig = ProjectMgr.BuildProject.CreateProjectInstance();
// Restore configuration
ProjectMgr.SetCurrentConfiguration();
}
if (currentConfig == null)
throw new Exception("Failed to retrieve properties");
// return property asked for
return currentConfig.GetProperty(propertyName);
}