public AssemblyInfo(CodeFile codeFile, CsProjFile projFile) { this._codeFile = codeFile; this._projFile = projFile; this._fileSystem = new FileSystem(); this.Initialize(); }
public SolutionProject(string text, string solutionDirectory) { SolutionProject solution = this; string[] parts = FubuCore.StringExtensions.ToDelimitedArray(text, '='); this._projectType = Guid.Parse(parts.First <string>().TextBetweenSquiggles()); this._projectGuid = Guid.Parse(parts.Last <string>().TextBetweenSquiggles()); string[] secondParts = FubuCore.StringExtensions.ToDelimitedArray(parts.Last <string>()); this._projectName = secondParts.First <string>().TextBetweenQuotes(); this._relativePath = secondParts.ElementAt(1).TextBetweenQuotes().Replace("\\", "/"); this._project = new Lazy <CsProjFile>(delegate { string filename = FubuCore.StringExtensions.AppendPath(solutionDirectory, new string[] { solution._relativePath }); if (File.Exists(filename)) { CsProjFile projFile = CsProjFile.LoadFrom(filename); solution.InitializeFromSolution(projFile, solution.Solution); return(projFile); } CsProjFile project = CsProjFile.CreateAtLocation(filename, solution._projectName); project.ProjectGuid = solution._projectGuid; return(project); }); }
private void InitializeFromSolution(CsProjFile projFile, Solution solution) { GlobalSection tfsSourceControl = solution.Sections.FirstOrDefault((GlobalSection section) => section.SectionName.Equals("TeamFoundationVersionControl")); if (tfsSourceControl != null) { this.InitializeTfsSourceControlSettings(projFile, solution, tfsSourceControl); } }
public void RemoveProject(CsProjFile project) { SolutionProject existing = this.FindProject(project.ProjectName); if (existing == null) { return; } this._projects.Remove(existing); }
public void AddProject(string solutionDirectory, CsProjFile project, string relativeTo) { SolutionProject existing = this.FindProject(project.ProjectName); if (existing != null) { return; } SolutionProject reference = new SolutionProject(project, solutionDirectory, relativeTo); this._projects.Add(reference); }
public static CsProjFile CreateAtSolutionDirectory(string assemblyName, string directory) { string fileName = FubuCore.StringExtensions.AppendPath(FubuCore.StringExtensions.AppendPath(directory, new string[] { assemblyName }), new string[] { assemblyName }) + ".csproj"; MSBuildProject project = MSBuildProject.Create(assemblyName); return(CsProjFile.CreateCore(project, fileName)); }
public SolutionProject(CsProjFile csProjFile, string solutionDirectory, string relativePath = "") { this._project = new Lazy <CsProjFile>(() => csProjFile); this._projectName = csProjFile.ProjectName; string fileName = csProjFile.FileName; if (!string.IsNullOrWhiteSpace(relativePath)) { fileName = relativePath; } this._relativePath = fileName; this._projectType = csProjFile.ProjectTypes().LastOrDefault <Guid>(); this._projectGuid = csProjFile.ProjectGuid; }
private static CsProjFile CreateCore(MSBuildProject project, string fileName) { MSBuildPropertyGroup arg_42_0; if ((arg_42_0 = project.PropertyGroups.FirstOrDefault((MSBuildPropertyGroup x) => x.Properties.Any((MSBuildProperty p) => p.Name == "ProjectGuid"))) == null) { arg_42_0 = (project.PropertyGroups.FirstOrDefault <MSBuildPropertyGroup>() ?? project.AddNewPropertyGroup(true)); } MSBuildPropertyGroup group = arg_42_0; group.SetPropertyValue("ProjectGuid", Guid.NewGuid().ToString().ToUpper(), true); CsProjFile file = new CsProjFile(fileName, project); file.AssemblyName = (file.RootNamespace = file.ProjectName); return(file); }
private void InitializeTfsSourceControlSettings(CsProjFile projFile, Solution solution, GlobalSection tfsSourceControl) { string projUnique = tfsSourceControl.Properties.FirstOrDefault((string item) => item.EndsWith(Path.GetFileName(projFile.FileName))); if (projUnique == null) { return; } int index = Convert.ToInt32(projUnique.Substring("SccProjectUniqueName".Length, projUnique.IndexOf('=') - "SccProjectUniqueName".Length).Trim()); projFile.SourceControlInformation = new SourceControlInformation(tfsSourceControl.Properties.First((string item) => item.StartsWith("SccProjectUniqueName" + index)).Split(new char[] { '=' })[1].Trim(), tfsSourceControl.Properties.First((string item) => item.StartsWith("SccProjectName" + index)).Split(new char[] { '=' })[1].Trim(), tfsSourceControl.Properties.First((string item) => item.StartsWith("SccLocalPath" + index)).Split(new char[] { '=' })[1].Trim()); }
public void AddProject(CsProjFile project) { this.AddProject(this.ParentDirectory, project, String.Empty); }
public ProjectReference(CsProjFile targetProject, CsProjFile reference) : base("ProjectReference") { base.Include = Path.Combine(FubuCore.StringExtensions.PathRelativeTo(reference.ProjectDirectory, targetProject.ProjectDirectory), Path.GetFileName(reference.FileName)); this.ProjectGuid = reference.ProjectGuid; this.ProjectName = reference.ProjectName; }
public static SolutionProject CreateNewAt(string solutionDirectory, string projectName) { CsProjFile csProjFile = CsProjFile.CreateAtSolutionDirectory(projectName, solutionDirectory); return(new SolutionProject(csProjFile, solutionDirectory)); }
public static CsProjFile CreateAtLocation(string fileName, string assemblyName) { return(CsProjFile.CreateCore(MSBuildProject.Create(assemblyName), fileName)); }
public void AddProject(CsProjFile project) { GenericEnumerableExtensions.Fill <CsProjFile>(this._projects, project); }