private static Project GetProject(ITaskItem referenceProject) { var fullPath = referenceProject.FullPath(); var project = ProjectCollection .GlobalProjectCollection .LoadedProjects .Where(p => StringComparer.OrdinalIgnoreCase.Compare(p.FullPath, fullPath) == 0) .FirstOrDefault(); if (project == null) { project = new Project( fullPath, new Dictionary <string, string>(2) { { "Configuration", referenceProject.GetMetadata("Configuration") }, { "Platform", referenceProject.GetMetadata("Platform") } }, null); } return(project); }
public static string RelativeTo(this ITaskItem item, string baseDirectory) { return(item.FullPath().RelativeTo(baseDirectory)); }
public static string CombineWith(this ITaskItem item, string relativePath) { return(Path.Combine(item.FullPath(), relativePath)); }
public static string FullDirectoryPath(this ITaskItem item) { return(Path.GetDirectoryName(item.FullPath())); }
public static bool ValidProjectForNuBuildDependencyCollection(this ITaskItem referenceProject) => ValidProjectForNuBuildDependencyCollection(referenceProject.FullPath());
public NuBuildReferenceProjectFactory(ITaskItem referenceProject, ITaskItem[] referenceLibraries) : base(referenceProject) { TargetDir = referenceLibraries .Where(referenceLibrary => referenceLibrary.MSBuildSourceProjectFile() == referenceProject.FullPath()) .Select(referenceLibrary => Path.GetDirectoryName(referenceLibrary.FullPath()) + Path.DirectorySeparatorChar) .First(); }