8

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?

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
Richard Moss
  • 1,550
  • 3
  • 26
  • 43

3 Answers3

9

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

Frank Racis
  • 1,630
  • 17
  • 15
  • Frank - thanks very much, it's now loaded into VS2012. With the caveat that the custom region file I use is only partially working now, peculiar as it's worked fine in VS2010 forever it seems. Thanks for the updated setup! No wonder I couldn't get it working without knowing about the _Config suffix *sigh*. Thanks again! Richard Moss – Richard Moss Sep 07 '12 at 13:19
  • 2
    I had pulled the code from the latest Regionerate SVN, which was newer than the VS2010 release and introduced a bug involving static members. Try 8.0.0.1 at https://skydrive.live.com/redir?resid=2FEB8D1988F04D77!566 – Frank Racis Sep 18 '12 at 03:16
  • Funny enough I found and fixed that same issue myself after I was having problems with your new build - and also got rid of that annoying messagebox which pops up every time you start VS and an extension has been updated etc. Shame the SVN repro is locked down or I'd have submitted a patch for it. – Richard Moss Sep 21 '12 at 09:58
  • 1
    @FrankRacis: Your VS 2012 version was working great. Thanks a lot for that. Can you please help me make it work with VS 2013? – Moon Aug 14 '13 at 21:33
  • @FrankRacis Can you help me make it work with VS 2015? – ArMaN Feb 15 '16 at 14:24
6

This is what you need to do to make VS2012 compatible Regionerate (0.8.0.1) by Frank Racis work with Visual Studio 2013.

  1. Modify this file: C:\Program Files (x86)\Regionerate\Regionerate.VS2012.AddIn Change version from 11 to 12: <Version>12.0</Version>

  2. Add the following string value in your registry:

    Location: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\AutomationOptions\LookInFolders

    Name: C:\Program Files (x86)\Regionerate\

Moon
  • 33,439
  • 20
  • 81
  • 132
  • Where do you get regionerate 8 from? the regionerate site only goes up to 7 and googling "regionerate 8 frank racis" just brings up a this question and something about a footballer – Pete Feb 14 '14 at 11:58
  • @Pete: Here is the link to Regionate 8 by Frank: https://skydrive.live.com/redir?resid=2FEB8D1988F04D77!565 – Moon Feb 18 '14 at 01:48
4

CodeMaid is a free and actively developed alternative. It has nearly all the features of Regionerate, plus some new stuff. One thing I really like is setting it to organize and clean unsaved files every time I build.

shoelzer
  • 10,648
  • 2
  • 28
  • 49
  • I actually do use CodeMaid as well, I think it's code cleanup functionality is pretty nice. But it's organization functionality isn't complex enough for my needs - I need to have everything sorted by type, visibility and alphabetically. Regionarate does that with a custom layout I've tinkered over the years, CodeMaid can't do this (yet). Plus, after trying to get rid of regions, I decided that I prefer to have them in place. So I use a combination of both Regionerate and CodeMaid. Extensions rock! – Richard Moss Oct 10 '12 at 07:15
  • 1
    CodeMaid has added more customization options to reorganization (ex: specifying your own preferred type order vs. the StyleCop standard), so it may do the trick for you now. If there's still something you're looking for hop on its Trello board and make a request! https://trello.com/board/future/4f6e6dcc255ed1e9085b8665 – Steve Cadwallader Mar 17 '13 at 11:40
  • Currently I use Resharper as that allows me to create my own layouts in a similar fashion to Regionerate - not to mention its a few billion times faster than Regionerate ever was, plus cleans up my code to boot. What's not to like :) – Richard Moss Mar 31 '13 at 16:57