private void Build(Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project project, string configuration, string projectFolder, string output, string outputFolder, ProjectBuildTracker projectBuildTracker) { foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Config config in project.Configs) { string configName = ""; if (config.Condition.IndexOf("Debug") != -1) { configName = "Debug"; } else if (config.Condition.IndexOf("Release") != -1) { configName = "Release"; } else { throw new System.Exception("Unknown configuration: " + config.Condition); } if (configName.ToLower().Equals(configuration.ToLower())) { BuildConfig( project.Name, projectFolder, project.ProjectGuid, output, outputFolder, project.Settings, config, project.References, project.ProjectReferences, project.Items, projectBuildTracker); return; } } throw new System.Exception("No project built."); }
private void Build(Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project project, string configuration, string projectFolder, ProjectBuildTracker projectBuildTracker) { foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Config config in project.Configs) { string configName = ""; if (config.Condition.IndexOf("Debug") != -1) { configName = "Debug"; } else if (config.Condition.IndexOf("Release") != -1) { configName = "Release"; } else { throw new System.Exception("Unknown configuration: " + config.Condition); } if (configName.ToLower().Equals(configuration.ToLower())) { string output = new System.IO.FileInfo(projectFolder).DirectoryName; if (!output.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { output += System.IO.Path.DirectorySeparatorChar; } string outputFolder = output; string extension = (project.Settings.OutputType.ToUpper().Equals("EXE") || project.Settings.OutputType.ToUpper().Equals("WINEXE")) ? ".exe" : ".dll"; output += config.OutputPath + project.Settings.AssemblyName + extension; this.Build(project, configuration, projectFolder, output, outputFolder, projectBuildTracker); break; } } }
private bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode CreateCSharpProjectTreeNode(string path) { if (Bamboo.VisualStudio.CSharpProjectDetector.Is2005(path)) { Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project project = Bamboo.VisualStudio.VisualStudio2005.CSharpProject.ProjectReader.Read(path); bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode projectTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode(project.Name, path, project, Images.CSharpProject); foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Reference reference in project.References) { bamboo.Controls.ProjectExplorer.TreeNodes.FileReferenceTreeNode fileReferenceTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.FileReferenceTreeNode(reference.Include, reference.HintPath); projectTreeNode.References.Add(fileReferenceTreeNode); } foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.ProjectReference projectReference in project.ProjectReferences) { bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode projectReferenceTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode(projectReference.Name); projectTreeNode.References.Add(projectReferenceTreeNode); } SortingTree fileTree = new SortingTree(); foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item item in project.Items) { string[] keys = item.Include.Split("\\".ToCharArray()); fileTree.Add(keys, item); } string rootPath = path.Substring(0, path.LastIndexOf("\\")); foreach (SortingTree node in fileTree.Nodes) { if (node.IsLeaf()) { Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item item = (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item)node.Value; projectTreeNode.Add(new bamboo.Controls.ProjectExplorer.TreeNodes.FileTreeNode(node.Name, rootPath + "\\" + item.Include, GetImage(node.Name))); } else { projectTreeNode.Add(CreateCSharpProjectFolderTreeNode(node, rootPath)); } } return(projectTreeNode); } // else if (Bamboo.VisualStudio.CSharpProjectDetector.Is2003(path)) // { // Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Project project = Bamboo.VisualStudio.VisualStudio2003.CSharpProject.ProjectReader.Read(path); // bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode projectTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectTreeNode(project.Name, path, project, Images.CSharpProject); // foreach (Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Reference reference in project.References) // { // int n = 0; //// bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode projectReferenceTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.ProjectReferenceTreeNode(); // } // Bamboo.Trees.Tree fileTree = new Bamboo.Trees.Tree(); // foreach (Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Item item in project.Items) // { //// bamboo.Controls.ProjectExplorer.TreeNodes.FileTreeNode fileTreeNode = new bamboo.Controls.ProjectExplorer.TreeNodes.FileTreeNode(); // int n = 0; // string[] keys = item.RelPath.Split("\\".ToCharArray()); // fileTree.Add(keys, item); // } // return projectTreeNode; // } else { throw new System.Exception("Invalid project version."); } }
private void Build(Bamboo.VisualStudio.VisualStudio2005.Solution.Models.Solution solution, string configuration, string projectFolder, string output) { this._projectBuildTracker.Clear(); System.Collections.Hashtable projectPaths = new System.Collections.Hashtable(); Bamboo.VisualStudio.ProjectDependencies.ProjectCollection projectsToResolve = new Bamboo.VisualStudio.ProjectDependencies.ProjectCollection(); foreach (Bamboo.VisualStudio.VisualStudio2005.Solution.Models.Project project in solution.Projects) { if (project.Path.ToLower().EndsWith(".csproj")) { string filename = projectFolder + System.IO.Path.DirectorySeparatorChar + project.Path; System.IO.FileInfo fileInfo = new System.IO.FileInfo(filename); string name = fileInfo.Name.Substring(0, fileInfo.Name.ToLower().LastIndexOf(".csproj")); System.IO.TextReader reader = fileInfo.OpenText(); Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project csproj2003 = Bamboo.VisualStudio.VisualStudio2005.CSharpProject.ProjectReader.Read(name, reader); reader.Close(); projectPaths.Add(csproj2003.ProjectGuid, filename); Bamboo.VisualStudio.ProjectDependencies.Project projectToResolve = new Bamboo.VisualStudio.ProjectDependencies.Project(); projectToResolve.Name = csproj2003.Name; projectToResolve.Guid = csproj2003.ProjectGuid; projectToResolve.Tag = csproj2003; foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Reference projectReference in csproj2003.References) { if (IsProject(projectReference.Include, solution.Projects)) { Bamboo.VisualStudio.ProjectDependencies.ProjectDependency projectDependency = new Bamboo.VisualStudio.ProjectDependencies.ProjectDependency(); projectDependency.Name = projectReference.Include; projectDependency.ProjectGuid = GetProjectGuid(projectReference.Include, solution.Projects); projectToResolve.Dependencies.Add(projectDependency); } } projectsToResolve.Add(projectToResolve); } else { throw new System.Exception("Unsupported project type."); } } Bamboo.VisualStudio.ProjectDependencies.ProjectCollection resolvedProjects = Bamboo.VisualStudio.ProjectDependencies.ProjectDependencyResolver.Resolve(projectsToResolve); foreach (Bamboo.VisualStudio.ProjectDependencies.Project project in resolvedProjects) { if (project.Tag is Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project) { Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project csproj2003 = (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project)project.Tag; string projectPath = projectPaths[csproj2003.ProjectGuid].ToString(); if (output.Length == 0) { this._csharpProjectBuilder.Build(projectPath, configuration, this._projectBuildTracker); } else { this._csharpProjectBuilder.Build(projectPath, configuration, output, this._projectBuildTracker); } if (this._csharpProjectBuilder.Succeeded) { this._projectBuildTracker.Add(csproj2003.ProjectGuid, this._csharpProjectBuilder.Assembly); } else { this._succeeded = false; return; } } } }