private void PopulateMapsForFileInputNode(GraphNode inputNode) { using (_gate.DisposableWait()) { var projectPath = inputNode.Id.GetNestedValueByName <Uri>(CodeGraphNodeIdName.Assembly); var filePath = inputNode.Id.GetNestedValueByName <Uri>(CodeGraphNodeIdName.File); if (projectPath == null || filePath == null) { return; } var project = _solution.Projects.FirstOrDefault( p => string.Equals(p.FilePath, projectPath.OriginalString, StringComparison.OrdinalIgnoreCase)); if (project == null) { return; } _nodeToContextProjectMap.Add(inputNode, project); var document = project.Documents.FirstOrDefault( d => string.Equals(d.FilePath, filePath.OriginalString, StringComparison.OrdinalIgnoreCase)); if (document == null) { return; } _nodeToContextDocumentMap.Add(inputNode, document); } }
private MSB.Execution.BuildResult Build(MSB.Execution.BuildParameters parameters, MSB.Execution.BuildRequestData requestData, CancellationToken cancellationToken) { using (buildManagerLock.DisposableWait()) { var buildManager = MSB.Execution.BuildManager.DefaultBuildManager; buildManager.BeginBuild(parameters); // enable cancellation of build CancellationTokenRegistration registration = default(CancellationTokenRegistration); if (cancellationToken.CanBeCanceled) { registration = cancellationToken.Register(() => { buildManager.CancelAllSubmissions(); }); } // execute build sync try { return(buildManager.BuildRequest(requestData)); } finally { if (registration != default(CancellationTokenRegistration)) { registration.Dispose(); } buildManager.EndBuild(); } } }