-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update samples for VS 17.9 GA (#315)
* Update samples for VS 17.9 GA --------- Co-authored-by: Jasmine Woon <[email protected]> Co-authored-by: Matteo Prosperi <[email protected]> Co-authored-by: Maia Kelner <[email protected]> Co-authored-by: Maia Kelner <[email protected]>
- Loading branch information
1 parent
c82aef9
commit cfde219
Showing
34 changed files
with
643 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
New_Extensibility_Model/Samples/VSProjectQueryAPISample/AddSolutionConfigurationCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace VSProjectQueryAPISample; | ||
|
||
using System.Globalization; | ||
using System.Text; | ||
using Microsoft.VisualStudio.Extensibility; | ||
using Microsoft.VisualStudio.Extensibility.Commands; | ||
using Microsoft.VisualStudio.Extensibility.Shell; | ||
using Microsoft.VisualStudio.ProjectSystem.Query; | ||
|
||
/// <summary> | ||
/// A sample command adding solution configurations. | ||
/// </summary> | ||
[VisualStudioContribution] | ||
public class AddSolutionConfigurationCommand : Command | ||
{ | ||
/// <inheritdoc /> | ||
public override CommandConfiguration CommandConfiguration => new("%VSProjectQueryAPISample.AddSolutionConfigurationCommand.DisplayName%") | ||
{ | ||
Placements = new[] { CommandPlacement.KnownPlacements.ToolsMenu }, | ||
Icon = new(ImageMoniker.KnownValues.Extension, IconSettings.IconAndText), | ||
}; | ||
|
||
/// <inheritdoc /> | ||
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken) | ||
{ | ||
const string solutionName = "ConsoleApp32"; | ||
|
||
await this.Extensibility.Workspaces().UpdateSolutionAsync( | ||
solution => solution.Where(solution => solution.BaseName == solutionName), | ||
solution => solution.AddSolutionConfiguration("Foo", "Debug", false), | ||
cancellationToken); | ||
|
||
await this.Extensibility.Shell().ShowPromptAsync($"Adding solution configuration called 'Foo'.", PromptOptions.OK, cancellationToken); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...Extensibility_Model/Samples/VSProjectQueryAPISample/DeleteSolutionConfigurationCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace VSProjectQueryAPISample; | ||
|
||
using System.Globalization; | ||
using System.Text; | ||
using Microsoft.VisualStudio.Extensibility; | ||
using Microsoft.VisualStudio.Extensibility.Commands; | ||
using Microsoft.VisualStudio.Extensibility.Shell; | ||
using Microsoft.VisualStudio.ProjectSystem.Query; | ||
|
||
/// <summary> | ||
/// A sample command deleting a solution configurations. | ||
/// </summary> | ||
[VisualStudioContribution] | ||
public class DeleteSolutionConfigurationCommand : Command | ||
{ | ||
/// <inheritdoc /> | ||
public override CommandConfiguration CommandConfiguration => new("%VSProjectQueryAPISample.DeleteSolutionConfigurationCommand.DisplayName%") | ||
{ | ||
Placements = new[] { CommandPlacement.KnownPlacements.ToolsMenu }, | ||
Icon = new(ImageMoniker.KnownValues.Extension, IconSettings.IconAndText), | ||
}; | ||
|
||
/// <inheritdoc /> | ||
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken) | ||
{ | ||
const string solutionName = "ConsoleApp32"; | ||
|
||
await this.Extensibility.Workspaces().UpdateSolutionAsync( | ||
solution => solution.Where(solution => solution.BaseName == solutionName), | ||
solution => solution.DeleteSolutionConfiguration("Foo"), | ||
cancellationToken); | ||
|
||
await this.Extensibility.Shell().ShowPromptAsync($"Deleting a solution configuration called 'Foo'.", PromptOptions.OK, cancellationToken); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
New_Extensibility_Model/Samples/VSProjectQueryAPISample/ProjectBuildCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace VSProjectQueryAPISample; | ||
|
||
using Microsoft.VisualStudio.Extensibility; | ||
using Microsoft.VisualStudio.Extensibility.Commands; | ||
using Microsoft.VisualStudio.Extensibility.Shell; | ||
using Microsoft.VisualStudio.ProjectSystem.Query; | ||
|
||
/// <summary> | ||
/// A sample command for building a project. | ||
/// </summary> | ||
[VisualStudioContribution] | ||
public class ProjectBuildCommand : Command | ||
{ | ||
/// <inheritdoc /> | ||
public override CommandConfiguration CommandConfiguration => new("%VSProjectQueryAPISample.ProjectBuildCommand.DisplayName%") | ||
{ | ||
Placements = new[] { CommandPlacement.KnownPlacements.ToolsMenu }, | ||
Icon = new(ImageMoniker.KnownValues.Extension, IconSettings.IconAndText), | ||
}; | ||
|
||
/// <inheritdoc /> | ||
public override async Task ExecuteCommandAsync(IClientContext context, CancellationToken cancellationToken) | ||
{ | ||
const string projectName = "ConsoleApp1"; | ||
|
||
var result = await this.Extensibility.Workspaces().QueryProjectsAsync( | ||
project => project.Where(p => p.Name == projectName), | ||
cancellationToken); | ||
|
||
await result.First().BuildAsync(cancellationToken); | ||
|
||
await this.Extensibility.Shell().ShowPromptAsync($"Building project {projectName}.", PromptOptions.OK, cancellationToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.