public virtual void InvalidateGroup() { // Set keyOutput to null so that a refresh will be performed the next time // a property getter is called. if (null != keyOutput) { // Once the group is invalidated there is no more reason to listen for events. Project.OnProjectPropertyChanged -= OnProjectPropertyChanged; } keyOutput = null; }
protected virtual void Refresh() { // Let MSBuild know which configuration we are working with Project.SetConfiguration(ProjectCfg.ConfigName); // Generate dependencies if such a task exist const string generateDependencyList = "AllProjectOutputGroups"; if (Project.BuildProject.Targets.ContainsKey(generateDependencyList)) { var succeeded = false; Project.BuildTarget(generateDependencyList, out succeeded); } // Rebuild the content of our list of output var outputType = TargetName + "Output"; outputs.Clear(); foreach (var assembly in Project.CurrentConfig.GetItems(outputType)) { var output = new Output(Project, assembly); outputs.Add(output); // See if it is our key output if ( string.Compare(assembly.GetMetadataValue("IsKeyOutput"), true.ToString(), StringComparison.OrdinalIgnoreCase) == 0) 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.OnProjectPropertyChanged += OnProjectPropertyChanged; }