Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.14 KB

File metadata and controls

45 lines (35 loc) · 1.14 KB
title description ms.date ms.topic author ms.author manager ms.subservice
Working with builds
Tips for working with builds.
12/01/2021
conceptual
madskristensen
madsk
pchapman
extensibility-integration

Working with builds in Visual Studio extensions

Here's a collection of small code samples on different ways to work with builds.

Build solution

To build the entire solution, call the BuildAsync() method.

bool buildStarted = await VS.Build.BuildSolutionAsync(BuildAction.Build);

Build project

You can build any project by passing it to the method.

Project project = await VS.Solutions.GetActiveProjectAsync();
await project.BuildAsync(BuildAction.Rebuild);

Set build property

Shows how to set a build property on the project.

Project project = await VS.Solutions.GetActiveProjectAsync();
bool succeeded = await project.TrySetAttributeAsync("propertyName", "value");

Get build property

Shows how to get a build property of any project or project item.

Project item = await VS.Solutions.GetActiveProjectAsync();
string value = await item.GetAttributeAsync("propertyName");