protected virtual void Refresh()
{
// Let MSBuild know which configuration we are working with
project.SetConfiguration(projectCfg.ConfigName, projectCfg.Platform);
// Generate dependencies if such a task exist
const string generateDependencyList = "AllProjectOutputGroups";
if(project.BuildProject.Targets.ContainsKey(generateDependencyList))
{
bool succeeded = false;
project.BuildTarget(generateDependencyList, out succeeded);
Debug.Assert(succeeded, "Failed to build target: " + generateDependencyList);
}
// Rebuild the content of our list of output
string outputType = this.targetName + "Output";
this.outputs.Clear();
foreach (MSBuildExecution.ProjectItemInstance assembly in project.CurrentConfig.GetItems(outputType))
{
Output output = new Output(project, assembly);
this.outputs.Add(output);
// See if it is our key output
if(String.Equals(assembly.GetMetadataValue("IsKeyOutput"), true.ToString(), StringComparison.OrdinalIgnoreCase))
keyOutput = output;
}
project.SetCurrentConfiguration();
// Now that the group is built we have to check if it is invalidated by a property
// change on the project.
project.ProjectPropertyChanged += new EventHandler<ProjectPropertyChangedArgs>(OnProjectPropertyChanged);
}