public override void Dispose() { if (Item is Solution) { // Dispose all builders bound to the solution being disposed RemoteBuildEngineManager.UnloadSolution(Solution.FileName).Ignore(); } base.Dispose(); }
internal protected override async Task OnEndBuildOperation(ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext, BuildResult result) { // Remove the session from the context and notify the build engine // manager that the session has finished. var id = operationContext.SessionData [MSBuildProjectOperationId]; operationContext.SessionData.Remove(MSBuildProjectOperationId); await RemoteBuildEngineManager.EndBuildSession(id); await base.OnEndBuildOperation(monitor, configuration, operationContext, result); }
public void ReleaseReference() { lock (usageLock) { if (--references == 0) { if (shuttingDown) { Dispose(); } RemoteBuildEngineManager.ReleaseProjectBuilder(engine).Ignore(); } } }
internal protected override Task OnBeginBuildOperation(ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext) { // If the context is a TargetEvaluationContext with a specific msbuild verbosity, use it // otherwise use the global setting var targetContext = operationContext as TargetEvaluationContext; var verbosity = targetContext != null ? targetContext.LogVerbosity : Runtime.Preferences.MSBuildVerbosity.Value; var logger = targetContext != null ? new ProxyLogger(null, targetContext.Loggers) : null; // Start the build session object sessionId = RemoteBuildEngineManager.StartBuildSession(monitor, logger, verbosity, GetSolutionConfigurations(configuration)); // Store the session handle in the context, so that it can be later used to // add builds to the session. operationContext.SessionData [MSBuildProjectOperationId] = sessionId; return(base.OnBeginBuildOperation(monitor, configuration, operationContext)); }
async void Dispose(bool releaseProjectBuilder = false) { if (!MSBuildProjectService.ShutDown && engine != null) { var currentEngine = engine; Task.Run(async() => { try { // Run this outside the usageLock to avoid a deadlock with RemoteBuildEngine's remoteProjectBuilders lock. await currentEngine.UnloadProject(this, projectId).ConfigureAwait(false); } catch { // Ignore } if (releaseProjectBuilder) { await RemoteBuildEngineManager.ReleaseProjectBuilder(currentEngine); } }).Ignore(); GC.SuppressFinalize(this); engine = null; } }