コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }