Thursday, October 22, 2009

Hack 92. Manage Add-ins











 < Day Day Up > 





Hack 92. Manage Add-ins





Visual Studio can do a lot on its own. You can

have it do so much more if you take advantage of add-ins
.





Visual

Studio add-ins are an excellent way to expand on the functionality of

Visual Studio. Throughout this book, we have talked about a number of

different add-ins and how they can be used to make the most out of

Visual Studio. We have even talked about how to write add-ins [Hack #89] . This hack explains how to

best work with add-ins. They can sometimes be troublesome and hard to

manage.







13.2.1. Installing Add-ins





All

add-ins

should come with an installer; if they don't, then

they probably come with some sort of detailed instructions on where

you should put files and how you should modify the

registry

to get everything working.









It is usually a good idea to close Visual Studio before running any

add-in installation programs. Most installation programs

won't stop you from installing with Visual Studio

open, but this can lead to strange behavior, especially if you are

uninstalling an old version of an add-in and installing a new

version.








Each add-in has to be added to the registry for every version of

Visual Studio that it will run in. Because of this, you will

sometimes run across an add-in whose installer is configured to

install for one version of Visual Studio, but not the version you are

using. You can often duplicate the registry settings from one version

and then move them to the other version, but this

won't work all the time�in fact, it might not

work most of the time�but sometimes it is well worth a shot.





Here is the process for moving the registry settings from one version

to another:





  1. Open regedit (Start Run

    type regedit).

  2. Navigate to the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<7.0>\AddIns\<YourAddin>.

  3. Right-click on the key and choose Export from the context menu that

    appears.

  4. Save the .reg file to your computer.

  5. Open the .reg file in Notepad and replace all

    instances of \7.0\ with

    \7.1\. (This would move settings from

    Visual Studio .NET 2002 to Visual Studio .NET 2003. Use the version

    numbers that apply to your version of Visual Studio.)

  6. Save and close the .reg file.

  7. Double-click the .reg file and click OK when the

    dialog asks if you want to add this information to your registry.



After following this procedure, the add-in may or may not work in the

new version of Visual Studio, but it is worth trying until the author

comes out with a new version tailored to your version of Visual

Studio.









13.2.2. Add-in Manager





The

Add-in Manager can be found in Tools

Add-in Manager and is shown in Figure 13-1.







Figure 13-1. Add-in Manager







The Add-in Manager configures the add-ins that are installed for your

version of Visual Studio. The leftmost column displays the name of

the add-in and a checkbox. If that checkbox is checked, it means that

the add-in is currently loaded. You can check this checkbox and then

click OK, and the add-in will be enabled for just this instance of

Visual Studio; when you restart Visual Studio, the add-in will not

automatically be loaded again. The checkbox in the Startup column

controls whether the add-in will be automatically loaded each and

every time Visual Studio is loaded. I find that, unless you use an

add-in constantly, it is best to leave it unavailable until you need

it. For add-ins you use constantly though, it is nice to have them

automatically available when you load the IDE. The last checkbox,

under the column Command Line, specifies whether this add-in should

be loaded when Visual Studio is accessed for command-line operations.

For instance, you can build a solution by calling the

devenv.exe command with the

/build switch, and this checkbox determines if the

add-in should be loaded when Visual Studio is started this way.









13.2.3. Repairing Add-ins





Sometimes add-ins just

don't work properly. You can try a couple things to

get an add-in to work properly. Sometimes simply disabling the add-in

and restarting Visual Studio will fix your problems. The next tactic

should be to run the repair function of the add-in installer (if one

exists; rerun the installer to see if it offers you this option),

which usually does a fair job of fixing any problems. If this does

not work, you can take a couple of other steps to try and get the

add-in working again.





Visual Studio includes a command-line switch called

/setup that will do a reset on Visual Studio,

restoring it to its initial state. Using this switch will erase some

of your customizations, but sometimes it is the only way to get an

add-in, or even Visual Studio itself, working properly again.





There is also a

/safemode command-line switch that will start

Visual Studio in safe mode. Visual Studio safe mode loads only the

default environment and services, which disables any VSIP add-ins

(not all add-ins) that might be causing a problem.



















     < Day Day Up > 



    No comments:

    Post a Comment