public Project(StructEx.Solution solution, string title, string fileName) : base(solution, title, fileName) { Files = new List <File>(); ProjectContent = new CSharpProjectContent(); ResolvedReferencedAssemblies = new List <IUnresolvedAssembly>(); ProjectContent = ProjectContent.SetAssemblyName(AssemblyName); ProjectContent = ProjectContent.SetProjectFileName(fileName); ProjectContent = ProjectContent.SetCompilerSettings(Utils.Convert.ToCompilerSettings(CompilerSettings)); foreach (var sourceCodeFile in MsBuildProject.GetItems("Compile")) { Files.Add(new File(this, Path.Combine(MsBuildProject.DirectoryPath, sourceCodeFile.EvaluatedInclude))); } var files = Files.Select(f => f.UnresolvedTypeSystemForFile); ProjectContent = ProjectContent.AddOrUpdateFiles(files); foreach (var projectReference in ReferencedProjects) { ProjectContent = ProjectContent.AddAssemblyReferences(new[] { new ProjectReference(projectReference) }); } ResolveAssemblies(); }
public virtual IEnumerable <string> GetFullPaths(string fileName) { foreach (var projectItem in MsBuildProject.GetItems()) { var itemFileName = Path.GetFileName(projectItem.EvaluatedInclude); if (string.Equals(fileName, itemFileName, StringComparison.OrdinalIgnoreCase)) { yield return(Path.Combine(ProjectFullPath, projectItem.EvaluatedInclude)); } } }
protected virtual object GetReference(string name) { return(MsBuildProject.GetItems("Reference").FirstOrDefault(item => new AssemblyName(item.EvaluatedInclude).Name.Equals(name, StringComparison.OrdinalIgnoreCase))); }
public virtual bool FileExistsInProject(string path) { return(MsBuildProject.GetItems().Any(t => t.EvaluatedInclude.Equals(path, StringComparison.OrdinalIgnoreCase) && (string.IsNullOrEmpty(t.ItemType) || t.ItemType[0] != '_'))); }