public void AddProjectsToSolutionExplorer(Folder root, IEnumerable <Project> projects)
        {
            if (!ProjectFilePath.EndsWith(".sln", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            Dictionary <string, IEnumerable <string> > projectToSolutionFolderMap = null;

            if (!Configuration.FlattenSolutionExplorer)
            {
                projectToSolutionFolderMap = GetProjectToSolutionFolderMap(ProjectFilePath);
            }

            var processedAssemblyNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var project in projects)
            {
                if (!processedAssemblyNames.Add(project.AssemblyName))
                {
                    // filter out multiple projects with the same assembly name
                    continue;
                }

                if (Configuration.FlattenSolutionExplorer)
                {
                    AddProjectToFolder(root, project);
                }
                else
                {
                    AddProjectToFolder(root, project, projectToSolutionFolderMap);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Validates the K2 project.
        /// </summary>
        private void ValidateK2Project()
        {
            // Make sure that it's a K2 project
            if (!ProjectFilePath.EndsWith(".k2proj"))
            {
                throw new ArgumentException("Project file must end with .k2proj.\n");
            }

            // If not using the local environment cache then make sure that credentials are available
            if (!UseEnvironmentCache &&
                (string.IsNullOrEmpty(WindowsDomain) ||
                 string.IsNullOrEmpty(WindowsUsername) ||
                 string.IsNullOrEmpty(WindowsPassword)))
            {
                throw new ArgumentException("Valid User credentials must be entered if not using local Environment cache.\n");
            }
        }