protected internal virtual void SetHintPathAndPrivateValue(ProjectInstance instance) { // Private means local copy; we want to know if it is already set to not override the default string privateValue = this.ItemNode.GetMetadata(ProjectFileConstants.Private); ThreadHelper.ThrowIfNotOnUIThread(); // Get the list of items which require HintPath IEnumerable <ProjectItemInstance> references = MSBuildProjectInstance.GetItems(instance, MsBuildGeneratedItemType.ReferenceCopyLocalPaths); // Remove the HintPath, we will re-add it below if it is needed if (!String.IsNullOrEmpty(this.assemblyPath)) { this.ItemNode.SetMetadata(ProjectFileConstants.HintPath, null); } // Now loop through the generated References to find the corresponding one foreach (ProjectItemInstance reference in references) { string fileName = Path.GetFileNameWithoutExtension(MSBuildItem.GetEvaluatedInclude(reference)); if (String.Compare(fileName, this.assemblyName.Name, StringComparison.OrdinalIgnoreCase) == 0) { // We found it, now set some properties based on this. string hintPath = MSBuildItem.GetMetadataValue(reference, ProjectFileConstants.HintPath); if (!String.IsNullOrEmpty(hintPath)) { if (Path.IsPathRooted(hintPath)) { hintPath = PackageUtilities.GetPathDistance(this.ProjectMgr.BaseURI.Uri, new Uri(hintPath)); } this.ItemNode.SetMetadata(ProjectFileConstants.HintPath, hintPath); // If this is not already set, we default to true if (String.IsNullOrEmpty(privateValue)) { this.ItemNode.SetMetadata(ProjectFileConstants.Private, true.ToString()); } } break; } } }
protected virtual void Refresh() { // Let MSBuild know which configuration we are working with ThreadHelper.ThrowIfNotOnUIThread(); _project.SetConfiguration(_projectCfg.ConfigCanonicalName); // Generate dependencies if such a task exist if (_project.ProjectInstance.Targets.ContainsKey(ProjectFileConstants.AllProjectOutputGroups)) { bool succeeded = false; _project.BuildTarget(ProjectFileConstants.AllProjectOutputGroups, out succeeded); // The next line triggers an exception for a customer that works with JetBrains. //Debug.Assert(succeeded, "Failed to build target: " + ProjectFileConstants.AllProjectOutputGroups); } // Rebuild the content of our list of output string outputType = _targetName + "Output"; this._outputs.Clear(); foreach (MSBuildExecution.ProjectItemInstance assembly in MSBuildProjectInstance.GetItems(_project.ProjectInstance, outputType)) { Output output = new Output(_project, assembly); this._outputs.Add(output); // See if it is our key output if (String.Compare(MSBuildItem.GetMetadataValue(assembly, "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); }