public void Project_path_is_case_insensitive() { var projectPath = @"c:\projects\project1\project.csproj"; var searchProjectPath = @"c:\Projects\Project1\Project.csproj"; var collection = new ProjectFileInfoCollection(); collection.Add(ProjectFileInfo.CreateEmpty(projectPath)); Assert.True(collection.TryGetValue(searchProjectPath, out var outInfo)); Assert.NotNull(outInfo); }
private async Task <ImmutableArray <ProjectFileInfo> > LoadProjectFileInfosAsync(string projectPath, DiagnosticReportingOptions reportingOptions, CancellationToken cancellationToken) { if (!_projectFileLoaderRegistry.TryGetLoaderFromProjectPath(projectPath, reportingOptions.OnLoaderFailure, out var loader)) { return(ImmutableArray <ProjectFileInfo> .Empty); // Failure should already be reported. } var projectFile = await DoOperationAndReportProgressAsync( ProjectLoadOperation.Evaluate, projectPath, targetFramework : null, () => loader.LoadProjectFileAsync(projectPath, _buildManager, cancellationToken) ).ConfigureAwait(false); // If there were any failures during load, we won't be able to build the project. So, bail early with an empty project. if (projectFile.Log.HasFailure) { _diagnosticReporter.Report(projectFile.Log); return(ImmutableArray.Create( ProjectFileInfo.CreateEmpty(loader.Language, projectPath, projectFile.Log))); } var projectFileInfos = await DoOperationAndReportProgressAsync( ProjectLoadOperation.Build, projectPath, targetFramework : null, () => projectFile.GetProjectFileInfosAsync(cancellationToken) ).ConfigureAwait(false); var results = ImmutableArray.CreateBuilder <ProjectFileInfo>(projectFileInfos.Length); foreach (var projectFileInfo in projectFileInfos) { // If any diagnostics were logged during build, we'll carry on and try to produce a meaningful project. if (!projectFileInfo.Log.IsEmpty) { _diagnosticReporter.Report(projectFileInfo.Log); } results.Add(projectFileInfo); } return(results.MoveToImmutable()); }