Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 915 Bytes

solutions.md

File metadata and controls

44 lines (33 loc) · 915 Bytes
title description ms.date ms.topic author ms.author manager ms.subservice
Working with solutions
Tips for working with solutions.
12/01/2021
conceptual
madskristensen
madsk
pchapman
extensibility-integration

Working with solutions in Visual Studio extensions

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

Solution events

Listen to any solution event.

VS.Events.SolutionEvents.OnAfterOpenProject += OnAfterOpenProject;

...

private void OnAfterOpenProject(Project obj)
{
    // Handle the event
}

Is a solution open?

Check if a solution is currently open or opening.

bool isOpen = await VS.Solutions.IsOpenAsync();
bool isOpening = await VS.Solutions.IsOpeningAsync();

Get all projects in solution

Get a list of all projects in the solution.

var projects = await VS.Solutions.GetAllProjectsAsync();