public async Task <IWorkspaceProjectContext> CreateProjectContextAsync( string languageName, string projectUniqueName, string?projectFilePath, Guid projectGuid, object?hierarchy, string?binOutputPath, string?assemblyName, CancellationToken cancellationToken) { var creationInfo = new VisualStudioProjectCreationInfo { AssemblyName = assemblyName, FilePath = projectFilePath, Hierarchy = hierarchy as IVsHierarchy, ProjectGuid = projectGuid, }; var visualStudioProject = await _projectFactory.CreateAndAddToWorkspaceAsync( projectUniqueName, languageName, creationInfo, cancellationToken).ConfigureAwait(false); #pragma warning disable IDE0059 // Unnecessary assignment of a value // At this point we've mutated the workspace. So we're no longer cancellable. cancellationToken = CancellationToken.None; #pragma warning restore IDE0059 // Unnecessary assignment of a value if (languageName == LanguageNames.FSharp) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var shell = await _serviceProvider.GetServiceAsync <SVsShell, IVsShell7>().ConfigureAwait(true); // Force the F# package to load; this is necessary because the F# package listens to WorkspaceChanged to // set up some items, and the F# project system doesn't guarantee that the F# package has been loaded itself // so we're caught in the middle doing this. var packageId = Guids.FSharpPackageId; await shell.LoadPackageAsync(ref packageId); await TaskScheduler.Default; } var project = new CPSProject(visualStudioProject, _workspace, _projectCodeModelFactory, projectGuid); // Set the output path in a batch; if we set the property directly we'll be taking a synchronous lock here and // potentially block up thread pool threads. Doing this in a batch means the global lock will be acquired asynchronously. project.StartBatch(); project.BinOutputPath = binOutputPath; await project.EndBatchAsync().ConfigureAwait(false); return(project); }
public CPSProjectCodeModel(CPSProject project, VisualStudioWorkspaceImpl visualStudioWorkspace, IServiceProvider serviceProvider) : base(project, visualStudioWorkspace, serviceProvider) { }
public CPSCodeModelInstanceFactory(CPSProject project) => _project = project;
public static void SetCommandLineArguments(CPSProject project, params string[] commandLineArguments) { var parsedArguments = GetParsedCommandLineArguments(project.Hierarchy, commandLineArguments); project.SetCommandLineArguments(parsedArguments); }