private IProject GetProject(VirtualFileSystemPath projectFilePath)
        {
            var projectsHostContainer      = _solution.ProjectsHostContainer();
            var solutionStructureContainer = projectsHostContainer.GetComponent <ISolutionStructureContainer>();
            var projectMark = solutionStructureContainer
                              .GetProjectsByLocation(projectFilePath)
                              .First();

            return(_solution.GetProjectByMark(projectMark).NotNull());
        }
Exemple #2
0
        private RdTask <RdProjectOutput> GetProjectOutputModel(Lifetime lifetime, RdGetProjectOutputArgs args)
        {
            var projectsHostContainer      = _solution.ProjectsHostContainer();
            var solutionStructureContainer = projectsHostContainer.GetComponent <ISolutionStructureContainer>();
            var projectMark = solutionStructureContainer
                              .GetProjectsByLocation(FileSystemPath.Parse(args.ProjectFilePath))
                              .First();

            var project         = _solution.GetProjectByMark(projectMark).NotNull();
            var targetFramework = project.TargetFrameworkIds
                                  // Take .NET Core first, then .NET Framework, and then .NET Standard. The comparer below will hold this order.
                                  .OrderBy(tfm => (!tfm.IsNetCoreApp, !tfm.IsNetFramework, !tfm.IsNetStandard))
                                  .First();

            _logger.Trace("TFM selected for project {0}: {1}", args, targetFramework);
            var assemblyInfo = project.GetOutputAssemblyInfo(targetFramework).NotNull();

            _logger.Trace("Assembly file path detected for project {0}: {1}", args, assemblyInfo.Location);
            return(RdTask <RdProjectOutput> .Successful(
                       new RdProjectOutput(targetFramework.Name, assemblyInfo.Location.ToString())));
        }