Search code examples
visual-studio-2010add-invisual-studio-2012region

Using Regionerate on VS2012, or alternative addin


I tend to use Regionerate quite extensively for reorganizing my code files. My only problem is I can't get it registered with VS2012. I've abandoned VS2010 fully in favour of VS2012 and it's galling to have to flip back just to run a macro to reorganize code files. I've never tried writing a VS addin before so I'm not at all familiar with the object model or how to register - seems the old addins are more complicated to install than the VS2010 extensions! I've also looked through the WIX setup XML and tried replicating the registry keys to no avail.

Does anyone know how to either register Regionerate with VS2012, or is there an alternative (free and which is maintained!) extension that provides the same functionality?


Solution

  • Two things needed for registration:

    • It looks like VS2012 doesn't read from the HKLM...\11.0\AutomationOptions key at runtime, only at first run. The corresponding key at HKCU...\11.0_Config\AutomationOptions needs to be set as well.
    • A new .AddIn file needs to be created with a Version of 11.0

    If you do that, Regionerate will appear, but will hang Studio when you try to use it. The Regionerate code has a bad version check ("not equal" instead of "less than") that will get stuck in code that doesn't work for VS2010/2012. Unchecking "Automatically collapse regions" in Regionerate settings might be enough to avoid the bad code.

    I made a new version that fixes the version check and has the correct install pieces for VS2012. You can download the installer and changed source files here:

    https://skydrive.live.com/redir?resid=2FEB8D1988F04D77!565