Example #1
0
 public virtual int get_KeyOutputObject(out IVsOutput2 ppKeyOutput) {
     if (_keyOutput == null) {
         Refresh();
         if (_keyOutput == null) {
             // horrible hack: we don't really have outputs but the Cider designer insists 
             // that we have an output so it can figure out our output assembly name.  So we
             // lie here, and then lie again to give a path in Output.get_Property
             _keyOutput = new Output(_project, null);
         }
     }
     ppKeyOutput = _keyOutput;
     if (ppKeyOutput == null)
         return VSConstants.S_FALSE;
     return VSConstants.S_OK;
 }
Example #2
0
        protected virtual void Refresh() {
            // Let MSBuild know which configuration we are working with
            _project.SetConfiguration(_projectCfg.ConfigName);

            // Generate dependencies if such a task exist
            if (_project.BuildProject.Targets.ContainsKey(_targetName)) {
                bool succeeded = false;
                _project.BuildTarget(_targetName, out succeeded);
                if (!succeeded) {
                    Debug.WriteLine("Failed to build target {0}", _targetName);
                    this._outputs.Clear();
                    return;
                }
            }

            // Rebuild the content of our list of output
            string outputType = _targetName + "Output";
            this._outputs.Clear();

            if (_project.CurrentConfig != null) {
                foreach (MSBuildExecution.ProjectItemInstance assembly in _project.CurrentConfig.GetItems(outputType)) {
                    Output output = new Output(_project, assembly);
                    _outputs.Add(output);

                    // See if it is our key output
                    if (_keyOutput == null ||
                        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 += new EventHandler<ProjectPropertyChangedArgs>(OnProjectPropertyChanged);
        }
Example #3
0
 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 -= new EventHandler<ProjectPropertyChangedArgs>(OnProjectPropertyChanged);
     }
     _keyOutput = null;
 }