private bool GetProjectItem(BuildProjectContextEntry projectEntry, out ProjectItem projectItem) { projectItem = projectEntry.ProjectItem; if (projectItem != null) { return(true); } string projectFile = projectEntry.FileName; if (SolutionProjectsExtensions.ProjectIsHidden(projectFile)) { return(false); } IDictionary <string, string> projectProperties = projectEntry.Properties; if (projectProperties.ContainsKey("Configuration") && projectProperties.ContainsKey("Platform")) { // TODO: Use find by FullNameProjectDefinition for the Batch Build only. string projectConfiguration = projectProperties["Configuration"]; string projectPlatform = projectProperties["Platform"]; var projectDefinition = new FullNameProjectDefinition(projectFile, projectConfiguration, projectPlatform); projectItem = _findProjectItem(projectDefinition, FindProjectProperty.FullNameProjectDefinition); if (projectItem == null) { TraceManager.Trace( string.Format("Project Item not found by: FullName='{0}', Configuration='{1}, Platform='{2}'.", projectDefinition.FullName, projectDefinition.Configuration, projectDefinition.Platform), EventLogEntryType.Warning); return(false); } } else { projectItem = _findProjectItem(projectFile, FindProjectProperty.FullName); if (projectItem == null) { TraceManager.Trace( string.Format("Project Item not found by FullName='{0}'.", projectFile), EventLogEntryType.Warning); return(false); } } projectEntry.ProjectItem = projectItem; return(true); }
public int UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel) { try { var projectItem = new UI.Models.ProjectItem(); var configPair = pCfgProj.ToConfigurationTuple(); SolutionProjectsExtensions.UpdateProperties(pHierProj.ToProject(), projectItem, configPair.Item1, configPair.Item2); var buildAction = StateConverterHelper.ConvertSolutionBuildFlagsToBuildAction(dwAction, (VSSOLNBUILDUPDATEFLAGS)dwAction); _buildInformationProvider.ProjectBuildStarted(projectItem, buildAction); return(VSConstants.S_OK); } catch (Exception ex) { _logger.Error(ex, ""); throw; } }