diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/AddSolutionConfigurationCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/AddSolutionConfigurationCommand.cs
index be624d62..ba024c4e 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/AddSolutionConfigurationCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/AddSolutionConfigurationCommand.cs
@@ -26,15 +26,13 @@ public class AddSolutionConfigurationCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var queryResults = await querySpace.QuerySolutionAsync(
+ var queryResults = await this.Extensibility.Workspaces().QuerySolutionAsync(
solution => solution.With(solution => solution.BaseName),
cancellationToken);
var solutionName = queryResults.First().BaseName;
- await querySpace.UpdateSolutionAsync(
+ await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.AddSolutionConfiguration("Foo", "Debug", false),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/CreateFileCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/CreateFileCommand.cs
index fb7bdd4f..ed14ece0 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/CreateFileCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/CreateFileCommand.cs
@@ -24,9 +24,7 @@ public class CreateFileCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- await querySpace.UpdateProjectsAsync(
+ await this.Extensibility.Workspaces().UpdateProjectsAsync(
project => project.Where(project => project.Name == "ConsoleApp1"),
project => project.CreateFile("CreatedFile.txt"),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/DeleteSolutionConfigurationCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/DeleteSolutionConfigurationCommand.cs
index 5e687376..aa4a2cc6 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/DeleteSolutionConfigurationCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/DeleteSolutionConfigurationCommand.cs
@@ -26,15 +26,13 @@ public class DeleteSolutionConfigurationCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var queryResults = await querySpace.QuerySolutionAsync(
+ var queryResults = await this.Extensibility.Workspaces().QuerySolutionAsync(
solution => solution.With(solution => solution.BaseName),
cancellationToken);
var solutionName = queryResults.First().BaseName;
- await querySpace.UpdateSolutionAsync(
+ await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.DeleteSolutionConfiguration("Foo"),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/MoveFileCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/MoveFileCommand.cs
index 42649f20..26db05a2 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/MoveFileCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/MoveFileCommand.cs
@@ -53,11 +53,10 @@ public override Task InitializeAsync(CancellationToken cancellationToken)
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
// Move File Workaround
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
StringBuilder sb = new StringBuilder("Move file from ");
// Query the source project to retrieve the path of the file to be moved.
- IQueryResults consoleApp1QueryResults = await querySpace.QueryProjectsAsync(
+ IQueryResults consoleApp1QueryResults = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.Where(p => p.Name == "ConsoleApp1")
.With(project => project.Path)
.With(project => project.Files
@@ -71,7 +70,7 @@ public override async Task ExecuteCommandAsync(IClientContext context, Cancellat
sb.Append(sourceFilePath + " to ");
// Query the destination project to retrieve its path.
- IQueryResults destinationProjectQueryResults = await querySpace.QueryProjectsAsync(
+ IQueryResults destinationProjectQueryResults = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.Where(p => p.Name == "ConsoleApp2")
.With(project => project.Path),
cancellationToken);
@@ -81,7 +80,7 @@ public override async Task ExecuteCommandAsync(IClientContext context, Cancellat
sb.Append(destinationProject);
// Add the source file to the destination project.
- await querySpace.UpdateProjectsAsync(
+ await this.Extensibility.Workspaces().UpdateProjectsAsync(
project => project.Where(project => project.Name == "ConsoleApp2"),
project => project.AddFileFromCopy(sourceFilePath, destinationProject),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ProjectBuildCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ProjectBuildCommand.cs
index f165a3cb..e8ee9c6d 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ProjectBuildCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ProjectBuildCommand.cs
@@ -24,10 +24,9 @@ public class ProjectBuildCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
const string projectName = "ConsoleApp1";
- var result = await querySpace.QueryProjectsAsync(
+ var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.Where(p => p.Name == projectName),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryFileCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryFileCommand.cs
index 48467e1c..e9ed088d 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryFileCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryFileCommand.cs
@@ -26,9 +26,7 @@ public class QueryFileCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var result = await querySpace.QueryProjectsAsync(
+ var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(project => project.Name)
.With(project => project.Path)
.With(project => project.Files.With(file => file.FileName)),
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByIdCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByIdCommand.cs
index c259b10e..6ec6ac53 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByIdCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByIdCommand.cs
@@ -26,11 +26,9 @@ public class QueryOutputGroupByIdCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
StringBuilder message = new StringBuilder();
- var result = await querySpace.QueryProjectsAsync(
+ var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(p => p.Name)
.With(p => p.ActiveConfigurations.With(c => c.Name)
.With(c => c.OutputGroups)),
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByNameCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByNameCommand.cs
index 7a4ecbc7..863e24f1 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByNameCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByNameCommand.cs
@@ -26,9 +26,7 @@ public class QueryOutputGroupByNameCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var result = await querySpace.QueryProjectsAsync(
+ var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(p => p.Name)
.With(p => p.ActiveConfigurations
.With(c => c.Name)
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByProjectCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByProjectCommand.cs
index 26509b94..9d78b3c7 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByProjectCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QueryOutputGroupByProjectCommand.cs
@@ -26,9 +26,7 @@ public class QueryOutputGroupByProjectCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var result = await querySpace.QueryProjectsAsync(
+ var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(p => p.Name)
.With(p => p.ActiveConfigurations
.With(c => c.Name)
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QuerySolutionConfigurations.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QuerySolutionConfigurations.cs
index 648ffdd3..94c44fbe 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QuerySolutionConfigurations.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/QuerySolutionConfigurations.cs
@@ -26,9 +26,7 @@ public class QuerySolutionConfigurations : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var results = await querySpace.QuerySolutionAsync(
+ var results = await this.Extensibility.Workspaces().QuerySolutionAsync(
solution => solution.With(solution => solution.SolutionConfigurations
.With(c => c.Name)),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/README.md b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/README.md
index fcfb584d..5e7e64ac 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/README.md
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/README.md
@@ -12,24 +12,14 @@ This extension demonstrates the most basic usage of the [VS Project Query API](h
The Project System Query API allows you to retrieve and update information in the Project System such as files, build configurations, dependencies, and much more.
-## Setting Up IProjectModelQueryableSpace
-
-Add `Microsoft.VisualStudio.ProjectSystem.Query` NuGet Package to the solution's `references` to get access to the API.
-
-The code snippet as seen below sets up the Project Query Service:
-
-```csharp
-WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-```
-
## Accessing API Metadata
-Once a `querySpace` is established, you may query information about the Project System on the Solution and/or Project level. Using the keyword `With`, you can specify the property and/or the collection they want to receive.
+Using the keyword `With`, you can specify the property and/or the collection they want to receive.
In our example, we call the `QueryProjectsAsync` method to get information from the projects, namely the Project Name, Project Path, Project Files, and File Names.
```csharp
-var result = await querySpace.QueryProjectsAsync(
+var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(project => project.Name)
.With(project => project.Path)
.With(project => project.Files.With(file => file.FileName)),
@@ -38,12 +28,12 @@ var result = await querySpace.QueryProjectsAsync(
## Modifying the Project System
-Using the same `querySpace`, you may modify data in your project system. `Where` is used to filter the query result based on a predicate. `UpdateProjectsAsync` is to update the object from the query result. These actions modifying the Project System may include creating/deleting files, building/cleaning/deploying solutions, setting properties, and more.
+`Where` is used to filter the query result based on a predicate. `UpdateProjectsAsync` is to update the object from the query result. These actions modifying the Project System may include creating/deleting files, building/cleaning/deploying solutions, setting properties, and more.
In our example, we call the `UpdateProjectsAsync` method to create a new file. The file we want to add is called `CreatedFile.txt`, and we want to add it to our project called `ConsoleApp1`.
```csharp
-await querySpace.UpdateProjectsAsync(
+await this.Extensibility.Workspaces().UpdateProjectsAsync(
project => project.Where(project => project.Name == "ConsoleApp1"),
project => project.AddFile("CreatedFile.txt"),
cancellationToken);
@@ -63,7 +53,7 @@ You may filter out metadata By Project in your solution.
In the snippet below, the result will contain information about Output Groups' names about all projects in our Solution.
```csharp
-var result = await querySpace.QueryProjectsAsync(
+var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(p => p.Name)
.With(p => p.ActiveConfigurations
.With(c => c.Name)
@@ -78,7 +68,7 @@ If you know which metadata you would like to obtain, you may filter that informa
In the snippet below, we call `OutputGroupsByName` to get specific Output Groups. The Project System Query API will add valid output group to the results, and invalid groups are skipped over. In this case, results will contain three output groups: `Built`, `XmlSerializer`, and `SourceFiles`.
```csharp
-var result = await querySpace.QueryProjectsAsync(
+var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(p => p.Name)
.With(p => p.ActiveConfigurations
.With(c => c.Name)
@@ -94,7 +84,7 @@ As usages for project query becomes more complex, you may realize that the requi
In our example, let's say we already queried information about Output Groups.
```csharp
-var result = await querySpace.QueryProjectsAsync(
+var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(p => p.Name)
.With(p => p.ActiveConfigurations.With(c => c.Name)),
cancellationToken);
@@ -135,8 +125,12 @@ Below is a showcase of queries that are available in the Project Query API
In project query, you also have the ability to invoke build actions on the solution level. These build actions include: `BuildAsync`, `RebuildAsync`, `CleanAsync`, `DebugLaunchAsync`, and `LaunchAsync`.
```csharp
-var result = await querySpace.Solutions
- .BuildAsync(cancellationToken);
+IQueryResults solutions = await this.Extensibility.Workspaces().QuerySolutionAsync(s => s, cancellationToken);
+
+foreach (var solution in solutions)
+{
+ await solution.AsQueryable().BuildAsync(cancellationToken);
+}
```
### Loading/Unloading a Project
@@ -144,7 +138,7 @@ var result = await querySpace.Solutions
In the snippet below, we specify the solution we would like to unload the project from and pass in the project path when we make our `UnloadProject` call.
```csharp
-await querySpace.UpdateSolutionAsync(
+await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.UnloadProject(projectPath),
cancellationToken);
@@ -153,7 +147,7 @@ await querySpace.UpdateSolutionAsync(
Similarly, we can load the project by calling the `ReloadProject` API.
```csharp
-await querySpace.UpdateSolutionAsync(
+await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.ReloadProject(projectPath),
cancellationToken);
@@ -165,7 +159,12 @@ await querySpace.UpdateSolutionAsync(
`SaveAsync` is an API call that can be used on the solution level.
```csharp
-var result = await querySpace.Solutions.SaveAsync(cancellationToken);
+IQueryResults solutions = await this.Extensibility.Workspaces().QuerySolutionAsync(s => s, cancellationToken);
+
+foreach (var solution in solutions)
+{
+ await solution.SaveAsync(cancellationToken);
+}
```
@@ -174,7 +173,7 @@ var result = await querySpace.Solutions.SaveAsync(cancellationToken);
Using the Project Query API, you also can select which projects get executed. In the sample below, we added two project paths to be set as the startup project.
```csharp
-await querySpace.UpdateSolutionAsync(
+await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.SetStartupProjects(projectPath1, projectPath2),
cancellationToken);
@@ -185,7 +184,7 @@ await querySpace.UpdateSolutionAsync(
`AddSolutionConfiguration` is an API call that takes in three parameters. The first parameter is the new name we want to give our new solution configuration. In this scenario, we will call our new solution configuration `Foo`. The next parameter is the configuration to base our new configuration. Below, we based our new solution configuration on the existing solution configuration, `Debug`. Lastly, the boolean represents if the solution configuration should be propagated.
```csharp
-await querySpace.UpdateSolutionAsync(
+await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.AddSolutionConfiguration("Foo", "Debug", false),
cancellationToken);
@@ -194,7 +193,7 @@ await querySpace.UpdateSolutionAsync(
`DeleteSolutionConfiguration` is an API call that removes the solution configuration. In the example below, we removed the solution configuration called `Foo`.
```csharp
-await querySpace.UpdateSolutionAsync(
+await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.DeleteSolutionConfiguration("Foo"),
cancellationToken);
@@ -217,11 +216,10 @@ await result.First().BuildAsync(cancellationToken);
In the example below, we specify the name of the project we would like to update. We then call `Rename` while passing in the new name of the project.
```csharp
-var result = await querySpace.Projects
- .Where(p => p.Name == "ConsoleApp1")
- .AsUpdatable()
- .Rename("NewProjectName")
- .ExecuteAsync(cancellationToken);
+var result = await this.Extensibility.Workspaces().UpdateProjectsAsync(
+ project => project.Where(p => p.Name == "ConsoleApp1"),
+ project => project.Rename("NewProjectName"),
+ cancellationToken);
```
@@ -229,7 +227,7 @@ var result = await querySpace.Projects
`RenameFile` takes the file path of the file you want to rename and the new name of the file. In the example below, we rename a file in a project called `ConsoleApp1` to `newName.cs`.
```csharp
-var result = await querySpace.UpdateProjectsAsync(
+var result = await this.Extensibility.Workspaces().UpdateProjectsAsync(
project => project.Where(project => project.Name == "ConsoleApp1"),
project => project.RenameFile(filePath, "newName.cs"),
cancellationToken);
@@ -240,10 +238,10 @@ var result = await querySpace.UpdateProjectsAsync(
In the code sample, we will query the projects in a solution and skip the first one. Let's say there are 3 projects in the solution. The first result will be skipped and will return the two remaining projects. Note: the order is not guaranteed.
```csharp
-var result = await querySpace.QueryProjectsAsync(
- project => project.With(p => p.Name)
- .Skip(1),
- cancellationToken);
+var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
+ project => project.With(p => p.Name)
+ .Skip(1),
+ cancellationToken);
```
### Tracking Queries
@@ -262,7 +260,7 @@ This example offers a temporary workaround to move a file by copying it to the n
The first step is to copy the original file to the new destination.
```csharp
-var result = await querySpace.UpdateProjectsAsync(
+var result = await this.Extensibility.Workspaces().UpdateProjectsAsync(
project => project.Where(project => project.Name == "ConsoleApp2"),
project => project.AddFileFromCopy(sourceFilePath, destinationProject),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ReloadProjectCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ReloadProjectCommand.cs
index 86f3cdaf..dbe338ac 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ReloadProjectCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/ReloadProjectCommand.cs
@@ -24,17 +24,15 @@ public class ReloadProjectCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
const string projectPath = "ConsoleApp1\\\\ConsoleApp1.csproj";
- var solutionQueryResults = await querySpace.QuerySolutionAsync(
+ var solutionQueryResults = await this.Extensibility.Workspaces().QuerySolutionAsync(
solution => solution.With(solution => solution.BaseName),
cancellationToken);
var solutionName = solutionQueryResults.First().BaseName;
- await querySpace.UpdateSolutionAsync(
+ await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.ReloadProject(projectPath),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameFileCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameFileCommand.cs
index 6f927ca4..efb4d772 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameFileCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameFileCommand.cs
@@ -45,10 +45,9 @@ public RenameFileCommand(TraceSource traceSource)
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
StringBuilder sb = new StringBuilder("Renamed file at ");
- IQueryResults consoleApp1QueryResults = await querySpace.QueryProjectsAsync(
+ IQueryResults consoleApp1QueryResults = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.Where(p => p.Name == "ConsoleApp1")
.With(project => project.Files
.With(f => f.FileName)
@@ -58,7 +57,7 @@ public override async Task ExecuteCommandAsync(IClientContext context, Cancellat
var filePath = consoleApp1QueryResults.First().Files.First().Path;
sb.Append(filePath);
- await querySpace.UpdateProjectsAsync(
+ await this.Extensibility.Workspaces().UpdateProjectsAsync(
project => project.Where(project => project.Name == "ConsoleApp1"),
project => project.RenameFile(filePath, "newName.cs"),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameProjectCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameProjectCommand.cs
index 3b797262..0a07fe47 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameProjectCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/RenameProjectCommand.cs
@@ -24,13 +24,10 @@ public class RenameProjectCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- var serviceBroker = context.Extensibility.ServiceBroker;
- ProjectQueryableSpace querySpace = new ProjectQueryableSpace(serviceBroker: serviceBroker, joinableTaskContext: null);
- var result = await querySpace.Projects
- .Where(p => p.Name == "ConsoleApp1")
- .AsUpdatable()
- .Rename("NewProjectName")
- .ExecuteAsync(cancellationToken);
+ IQueryResults consoleApp1QueryResults = await this.Extensibility.Workspaces().UpdateProjectsAsync(
+ project => project.Where(p => p.Name == "ConsoleApp1"),
+ project => project.Rename("NewProjectName"),
+ cancellationToken);
await this.Extensibility.Shell().ShowPromptAsync("Renamed Project to NewProjectName.", PromptOptions.OK, cancellationToken);
}
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SetStartupProjectsCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SetStartupProjectsCommand.cs
index 3669919b..b97bf915 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SetStartupProjectsCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SetStartupProjectsCommand.cs
@@ -24,13 +24,11 @@ public class SetStartupProjectsCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
const string solutionName = "ConsoleApp32";
const string projectPath1 = "ConsoleApp1\\\\ConsoleApp1.csproj";
const string projectPath2 = "ConsoleApp2\\\\ConsoleApp2.csproj";
- await querySpace.UpdateSolutionAsync(
+ await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.SetStartupProjects(projectPath1, projectPath2),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SkipOfNCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SkipOfNCommand.cs
index 6894a76a..6a06a350 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SkipOfNCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SkipOfNCommand.cs
@@ -51,9 +51,7 @@ public override Task InitializeAsync(CancellationToken cancellationToken)
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var result = await querySpace.QueryProjectsAsync(
+ var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(p => p.Name)
.Skip(1),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionBuildCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionBuildCommand.cs
index ee277fe3..3cdfa717 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionBuildCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionBuildCommand.cs
@@ -25,10 +25,11 @@ public class SolutionBuildCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- IServiceBroker serviceBroker = context.Extensibility.ServiceBroker;
- ProjectQueryableSpace querySpace = new ProjectQueryableSpace(serviceBroker: serviceBroker, joinableTaskContext: null);
- var result = await querySpace.Solutions
- .BuildAsync(cancellationToken);
+ IQueryResults solutions = await this.Extensibility.Workspaces().QuerySolutionAsync(s => s, cancellationToken);
+ foreach (var solution in solutions)
+ {
+ await solution.AsQueryable().BuildAsync(cancellationToken);
+ }
await this.Extensibility.Shell().ShowPromptAsync($"Building the solution.", PromptOptions.OK, cancellationToken);
}
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionSaveCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionSaveCommand.cs
index 51329a59..7057ed3a 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionSaveCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/SolutionSaveCommand.cs
@@ -25,9 +25,11 @@ public class SolutionSaveCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- IServiceBroker serviceBroker = context.Extensibility.ServiceBroker;
- ProjectQueryableSpace querySpace = new ProjectQueryableSpace(serviceBroker: serviceBroker, joinableTaskContext: null);
- var result = await querySpace.Solutions.SaveAsync(cancellationToken);
+ IQueryResults solutions = await this.Extensibility.Workspaces().QuerySolutionAsync(s => s, cancellationToken);
+ foreach (var solution in solutions)
+ {
+ await solution.SaveAsync(cancellationToken);
+ }
await this.Extensibility.Shell().ShowPromptAsync($"Saving the solution.", PromptOptions.OK, cancellationToken);
}
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/TrackProjectQueryCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/TrackProjectQueryCommand.cs
index 25f5dcae..235a9dea 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/TrackProjectQueryCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/TrackProjectQueryCommand.cs
@@ -50,9 +50,7 @@ public override Task InitializeAsync(CancellationToken cancellationToken)
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
- var projects = await querySpace.QueryProjectsAsync(
+ var projects = await this.Extensibility.Workspaces().QueryProjectsAsync(
project => project.With(project => project.Name),
cancellationToken);
diff --git a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/UnloadProjectCommand.cs b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/UnloadProjectCommand.cs
index 7f8a3bd0..eeb6ccf0 100644
--- a/New_Extensibility_Model/Samples/VSProjectQueryAPISample/UnloadProjectCommand.cs
+++ b/New_Extensibility_Model/Samples/VSProjectQueryAPISample/UnloadProjectCommand.cs
@@ -24,17 +24,15 @@ public class UnloadProjectCommand : Command
///
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken)
{
- WorkspacesExtensibility querySpace = this.Extensibility.Workspaces();
-
const string projectPath = "ConsoleApp1\\\\ConsoleApp1.csproj";
- var solutionQueryResults = await querySpace.QuerySolutionAsync(
+ var solutionQueryResults = await this.Extensibility.Workspaces().QuerySolutionAsync(
solution => solution.With(solution => solution.BaseName),
cancellationToken);
var solutionName = solutionQueryResults.First().BaseName;
- await querySpace.UpdateSolutionAsync(
+ await this.Extensibility.Workspaces().UpdateSolutionAsync(
solution => solution.Where(solution => solution.BaseName == solutionName),
solution => solution.UnloadProject(projectPath),
cancellationToken);