简体   繁体   English

Visual Studio 可扩展性 - 卸载当前项目

[英]Visual Studio Extensibility - Unload current project

I need to make a Visual Studio Extension/Plugin which involves unloading/reloading all projects in a solution.我需要制作一个 Visual Studio 扩展/插件,其中涉及卸载/重新加载解决方案中的所有项目。

Using the Visual Studio Extensibility SDK (C#) I have got as far as getting a list of the projects (EnvDTE.Project).使用 Visual Studio 可扩展性 SDK (C#),我已经获得了项目列表 (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.我看过一些与 DTE2.ExecuteCommand 相关的帖子,但后来找不到可用命令的列表以及如何使用它们。 Can someone point me in the right direction?有人可以指出我正确的方向吗?

You may use IVsSolutionInterface that has methods to load and unload project.您可以使用具有加载和卸载项目方法的 IVsSolutionInterface。 Try this extension method passing the project guid to the contructor.试试这个将项目 guid 传递给承包商的扩展方法。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM