locked
Addin/Package: How to programmatically unload a Macros IDE Project? RRS feed

  • Question

  • Hi,

    I am automating the testing of some auto-generated macros in Visual Studio and ideally would like to recreate a Macros project each time in the Macros IDE (I have to use the object model because the .vsmacros file is binary / custom). That is possible; its working: I can create a new Macros project and import all of the .vb files I need to put into that Macros project using an Addin (C#). Cool!

    But how do I *UNLOAD* a project in the Macros IDE? As part of my refresh step I want to tear down and remove my existing project and build it up from scratch.  If I right click on a Macros IDE project and select 'Unload Project' (with the macro recorder turned on) I see this code:

         DTE.ExecuteCommand("Tools.UnloadMacroProject")

    But that fails... it requires a parameter... and what parameter do I pass? I've tried the UniqueName, FullName and all other kinds of magic in the Project that I want to unload from the Macros IDE. I've obviously tried it on the _applicationObject (EnvDTE) and _applicationObject.MacrosIDE but it makes no difference.

    Is what I want to do possible? I know there are lots of differences between the main IDE and the Macros one... cheers?

    Graham

     

    Sunday, April 25, 2010 1:47 PM

Answers

  • Hi, Graham

    Whether in a project explorer or Macro explorer, the unload command only works on the selected item.

    So to unload the specific Macros, you must use UIHierarchy Interface, and use UIHierarchyItem.Select to select the Macro first.

    Note: If the current is record Macro, you are not able to unload it.

    Thanks

    Chao

    • Marked as answer by Grey Ham Tuesday, April 27, 2010 9:38 AM
    Tuesday, April 27, 2010 8:41 AM