Example #1
0
        /// <summary>
        /// Creates a project context for each target located in the project at <paramref name="projectPath"/>
        /// </summary>
        public static IEnumerable <ProjectContext> CreateContextForEachTarget(string projectPath, ProjectReaderSettings settings = null)
        {
            var project = ProjectReader.GetProject(projectPath);

            return(new ProjectContextBuilder()
                   .WithProjectReaderSettings(settings)
                   .WithProject(project)
                   .BuildAllTargets());
        }
Example #2
0
        /// <summary>
        /// Creates a project context for each target located in the project at <paramref name="projectPath"/>
        /// </summary>
        public static IEnumerable <ProjectContext> CreateContextForEachTarget(string projectPath)
        {
            if (!projectPath.EndsWith(Project.FileName))
            {
                projectPath = Path.Combine(projectPath, Project.FileName);
            }
            var project = ProjectReader.GetProject(projectPath);

            return(new ProjectContextBuilder()
                   .WithProject(project)
                   .BuildAllTargets());
        }
Example #3
0
        /// <summary>
        /// Creates a project context for each framework located in the project at <paramref name="projectPath"/>
        /// </summary>
        public static IEnumerable <ProjectContext> CreateContextForEachFramework(string projectPath)
        {
            if (!projectPath.EndsWith(Project.FileName))
            {
                projectPath = Path.Combine(projectPath, Project.FileName);
            }
            var project = ProjectReader.GetProject(projectPath);

            foreach (var framework in project.GetTargetFrameworks())
            {
                yield return(new ProjectContextBuilder()
                             .WithProject(project)
                             .WithTargetFramework(framework.FrameworkName)
                             .Build());
            }
        }
Example #4
0
        /// <summary>
        /// Creates a project context for each framework located in the project at <paramref name="projectPath"/>
        /// </summary>
        public static IEnumerable <ProjectContext> CreateContextForEachFramework(string projectPath, ProjectReaderSettings settings = null, IEnumerable <string> runtimeIdentifiers = null)
        {
            if (!projectPath.EndsWith(Project.FileName))
            {
                projectPath = Path.Combine(projectPath, Project.FileName);
            }
            var project = ProjectReader.GetProject(projectPath, settings);

            foreach (var framework in project.GetTargetFrameworks())
            {
                yield return(new ProjectContextBuilder()
                             .WithProject(project)
                             .WithTargetFramework(framework.FrameworkName)
                             .WithReaderSettings(settings)
                             .WithRuntimeIdentifiers(runtimeIdentifiers ?? Enumerable.Empty <string>())
                             .Build());
            }
        }