maxhap
maxhap

Reputation: 221

Visual Studio Extensibility - Unload current project

I need to make a Visual Studio Extension/Plugin which involves unloading/reloading all projects in a solution.

Using the Visual Studio Extensibility SDK (C#) I have got as far as getting a list of the projects (EnvDTE.Project). Sadly I can't find any decent documentation on then manipulating the projects.

I have seen a few posts relating to DTE2.ExecuteCommand, but then could not find a list of available commands and how to use them. Can someone point me in the right direction?

Upvotes: 1

Views: 468

Answers (1)

Roger Perroni
Roger Perroni

Reputation: 51

You may use IVsSolutionInterface that has methods to load and unload project. Try this extension method passing the project guid to the contructor.

private void UnloadProject(IVsSolution4 solution, Guid projectGuid)
    {
        int result;

        result = solution.UnloadProject(ref projectGuid, (uint)_VSProjectUnloadStatus.UNLOADSTATUS_UnloadedByUser);
        ErrorHandler.ThrowOnFailure(result);
    }

Upvotes: 2

Related Questions