Home >

VS Addin: Fast Add Reference Dialog - No more Coffee Break, Steve!

19. June 2009

UPDATE 3: The project is available on Google Code

UPDATE 2: Now solution folders and some other stuff are done, thanks to Huseyin Tufekcilerli

UPDATE: I updated the dlls and the source in the link, now it doesn't crash VS. Hopefully the only problem left is that solutions with multiple solution folders won't be reflected in Projects tab.

I have spent a couple of days on implementing a fast add reference dialog box for Visual Studio(with some help from an existing addin). The time of adding a reference has been a great time to have some coffee, to have lunch, or even a way to save economy (remember, developer time costs money!). If you don’t believe me, take a look at what tweeps say.

It is actually easy once you find some of the extension points of Visual Studio.

In my case, I had to implement IDTExtensibility2 which contains method signatures to be called when a plugin is loaded, unloaded etc.

As first step, I had added “Add Quick Reference” item to the context menu when a project is right clicked. This is the most tricky part as there is almost no documentation on that.

The method that we should implement for this is:

public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)

The type of the application parameter implements DTE2 interface and the addInInst parameter implements AddIn interface, which has all we need.

The DTE2 interface has CommandBars property which gives us access to various VS stuff. The matter is to find the right one. After for-looping all CommandBar item, i found that the place I should add my custom item is “Context Menus”->”Project and Solution Context Menus”->”Reference Root”. Man this is hard to locate! Looking forward to MEF in 2010!

applicationObject = (DTE2)application;
addInInstance = (AddIn)addInInst;
CommandBars cb = applicationObject.CommandBars as CommandBars;
CommandBar bar = cb["Context Menus"];
CommandBarPopup cbarControl = bar.Controls["Project and Solution Context Menus"] as CommandBarPopup;
var commandBarControls = cbarControl.Controls;
this.referenceRoots = commandBarControls["Reference Root"] as CommandBarPopup;button = this.referenceRoots.Controls.Add(MsoControlType.msoControlButton,
                           System.Reflection.Missing.Value,
                           System.Reflection.Missing.Value, 1, true)   as CommandBarButton;
button.Caption = "Add Quick Reference";
button.Click += oControl_Click;

There is one thing to be careful about: If you want to handle events of a button, for example, you should hold a reference in your class. Local method variables wouldn’t work. This situation is better told here

Now, I am done. I should now design the dialog itself that looks very similar to the original one. There is another problem: There is no "Windows Explorer Like” control for Windows Forms. There is OpenFileDialog but it is a dialog, not a control. I found the most similar one at GongShell Project which is licensed under GPL.

My current screen looks like the one below:

image

Very similar, even if I say so myself.

One thing to notice here is that the first tab is browse(.NET in original dialog), second is .net (Browse in original dialog) and third one is Projects. I haven’t written “Recent” part as I don’t want to deal with I/O really.

I believe that Browse window is more frequently used than .NET tab. There can be more improvements on that screen, such as having “common” tab which does the copying of commonly used references to a new project but hey this is a demonstration only ! :)

The items in the .NET tab are loaded in the background, and once it is loaded, it will be cached during the lifetime of the application.

I won’t comment more on the code, go grab it and try it. I wont continue developing this little addin, so you are free to do it on your own. Just drop me an email when you do it, though.

I just warn you: Com stuff is like walking on a mine field, and I am not taking any responsibility in case you loose data.

Download the code and the binaries here and put the binaries into Documents\Visual Studio 2008\Addins folder. Have fun!

Comments

Imran
Imran
6/20/2009 12:16:47 AM #
Nice, the vs reference add dialogue is such a pain and so slow. Is it currently possible to assign a keyboard shortcut for this?
6/20/2009 12:20:43 AM #
Unfortunately, no. It is not yet possible. There are some other nasty bugs as well (check the beginning of the posts).
If me and Chris change this so that it is a R# plugin, then it may be easier to develop the addin.
6/25/2009 10:36:37 PM #
Tuna,

I see the addin referenced by Visual Studio (in AddIn manager).

But no 'quick add reference' context-menu item appears...

Any idea? What can I do?
6/25/2009 10:41:42 PM #
Never mind,

I need to read better... It's in the 'Reference Root' context menu. Not the project Context menu.

This doesn't work for me btw.
As soon as the dialog shows up, VS crashes
6/25/2009 11:15:04 PM #
Looks like you are facing yet another problem with Registry...

devlicio.us/.../...ialog-no-more-coffee-break.aspx

Move to the bottom... There is no standard way of getting lists of the assemblies you see in normal addin...
1/28/2010 10:04:14 AM #
Pingback from bulutlararasi.com

VS 2010′un En Çarpıcı YeniliÄŸi | Bulutlararası
11/20/2010 4:18:27 AM #
Hello People! Your blog is awesome! I would like to visit it everyday. It's very informative and amazing
11/25/2010 11:03:20 AM #
thats good article!!
12/7/2010 9:39:20 AM #
It's so tough to encounter right information on the blog. I realy loved reading this post. It has strengthen my faith more. You all do such a great job at such Concepts...can't tell you how much I, for one appreciate all you do
xd
12/18/2010 11:26:25 PM #
Tibia Gold is the currency in Tibia(MMoRPG) .There are many items including Tibia weapons like
Tibia Axe,Tibia Sword,Tibia Rod,Tibia Wand,Tibia Shield
And also Tibia euipment
Tibia helmet,Tibia armor,Tibia legs, Tibia boots
These items let you always prevailed(Not only play a important role in the war, but also pawn the monster smoothly and level up easier)
You can buy all these items by using Tibia gold
And there still many sites u can buy tibia gold by real money like tibiaitem.com,tibiamoney.com,gamegoldcoin.com,gamezmoney.com,10minget.com,enjoygolds.com,tibiagoods.com gameotl.com etc
Good luck, have fun in Tibia

[url=http://www.tibiamoney.com]tibia gold[/url]
[url=http://www.tibiamoney.com]tibia money[/url]
[url=http://www.tibiamoney.com]tibia item[/url]
[url=http://www.tibiamoney.com]tibia items[/url]
[url=http://www.tibiamoney.com]buy tibia gold[/url]
[url=http://www.tibiamoney.com]tibia weapon[/url]
[url=http://www.tibiamoney.com]tibia leveling[/url]
[url=http://www.tibiamoney.com]armor tibia[/url]
[url=http://www.tibiamoney.com]tibia level[/url]
[url=http://www.tibiamoney.com]tibia account[/url]

[url=http://www.gamezmoney.com]tibia gold[/url]
[url=http://www.gamezmoney.com]tibia money[/url]
[url=http://www.gamezmoney.com]tibia item[/url]
[url=http://www.gamezmoney.com]tibia items[/url]
[url=http://www.gamezmoney.com]buy tibia gold[/url]
[url=http://www.gamezmoney.com]tibia weapon[/url]
[url=http://www.gamezmoney.com]tibia leveling[/url]
[url=http://www.gamezmoney.com]armor tibia[/url]
[url=http://www.gamezmoney.com]tibia level[/url]
[url=http://www.gamezmoney.com]tibia account[/url]

[url=http://www.gamegoldcoin.com]tibia gold[/url]
[url=http://www.gamegoldcoin.com]tibia money[/url]
[url=http://www.gamegoldcoin.com]tibia item[/url]
[url=http://www.gamegoldcoin.com]tibia items[/url]
[url=http://www.gamegoldcoin.com]buy tibia gold[/url]
[url=http://www.gamegoldcoin.com]tibia weapon[/url]
[url=http://www.gamegoldcoin.com]tibia leveling[/url]
[url=http://www.gamegoldcoin.com]armor tibia[/url]
[url=http://www.gamegoldcoin.com]tibia level[/url]
[url=http://www.gamegoldcoin.com]tibia account[/url]

[url=http://www.10minget.com]tibia gold[/url]
[url=http://www.10minget.com]tibia money[/url]
[url=http://www.10minget.com]tibia item[/url]
[url=http://www.10minget.com]tibia items[/url]
[url=http://www.10minget.com]buy tibia gold[/url]
[url=http://www.10minget.com]tibia weapon[/url]
[url=http://www.10minget.com]tibia leveling[/url]
[url=http://www.10minget.com]armor tibia[/url]
[url=http://www.10minget.com]tibia level[/url]
[url=http://www.10minget.com]tibia account[/url]

[url=http://www.gamexgolds.com]tibia gold[/url]
[url=http://www.gamexgolds.com]tibia money[/url]
[url=http://www.gamexgolds.com]tibia item[/url]
[url=http://www.gamexgolds.com]tibia items[/url]
[url=http://www.gamexgolds.com]buy tibia gold[/url]
[url=http://www.gamexgolds.com]tibia weapon[/url]
[url=http://www.gamexgolds.com]tibia leveling[/url]
[url=http://www.gamexgolds.com]armor tibia[/url]
[url=http://www.gamexgolds.com]tibia level[/url]
[url=http://www.gamexgolds.com]tibia account[/url]

[url=http://www.enjoygolds.com]tibia gold[/url]
[url=http://www.enjoygolds.com]tibia money[/url]
[url=http://www.enjoygolds.com]tibia item[/url]
[url=http://www.enjoygolds.com]tibia items[/url]
[url=http://www.enjoygolds.com]buy tibia gold[/url]
[url=http://www.enjoygolds.com]tibia weapon[/url]
[url=http://www.enjoygolds.com]tibia leveling[/url]
[url=http://www.enjoygolds.com]armor tibia[/url]
[url=http://www.enjoygolds.com]tibia level[/url]
[url=http://www.enjoygolds.com]tibia account[/url]

[url=http://www.tibiagoods.com]tibia gold[/url]
[url=http://www.tibiagoods.com]tibia money[/url]
[url=http://www.tibiagoods.com]tibia item[/url]
[url=http://www.tibiagoods.com]tibia items[/url]
[url=http://www.tibiagoods.com]buy tibia gold[/url]
[url=http://www.tibiagoods.com]tibia weapon[/url]
[url=http://www.tibiagoods.com]tibia leveling[/url]
[url=http://www.tibiagoods.com]armor tibia[/url]
[url=http://www.tibiagoods.com]tibia level[/url]
[url=http://www.tibiagoods.com]tibia account[/url]

[url=http://www.gamegoldmoney.com]tibia gold[/url]
[url=http://www.gamegoldmoney.com]tibia money[/url]
[url=http://www.gamegoldmoney.com]tibia item[/url]
[url=http://www.gamegoldmoney.com]tibia items[/url]
[url=http://www.gamegoldmoney.com]buy tibia gold[/url]
[url=http://www.gamegoldmoney.com]tibia weapon[/url]
[url=http://www.gamegoldmoney.com]tibia leveling[/url]
[url=http://www.gamegoldmoney.com]armor tibia[/url]
[url=http://www.gamegoldmoney.com]tibia level[/url]
[url=http://www.gamegoldmoney.com]tibia account[/url]

[url=http://www.gameotl.com/tibia.htm]tibia gold[/url]
[url=http://www.gameotl.com/tibia.htm]tibia money[/url]
[url=http://www.gameotl.com/tibia.htm]tibia item[/url]
[url=http://www.gameotl.com/tibia.htm]tibia items[/url]
[url=http://www.gameotl.com/tibia.htm]buy tibia gold[/url]
[url=http://www.gameotl.com/tibia.htm]tibia weapon[/url]
[url=http://www.gameotl.com/tibia.htm]tibia leveling[/url]
[url=http://www.gameotl.com/tibia.htm]armor tibia[/url]
[url=http://www.gameotl.com/tibia.htm]tibia level[/url]
[url=http://www.gameotl.com/tibia.htm]tibia account[/url]









Guild Wars is an episodic series of multiplayer online role-playing games developed by ArenaNet and published by NCsoft. Although often defined as an MMORPG, the developers define it as a CORPG due to notable differences from the MMORPG genre
[url=http://www.guildwarsgoldmoney.com]guild wars armor[/url]
[url=http://www.guildwarsgoldmoney.com]guild wars platinum[/url]
[url=http://www.guildwarsgoldmoney.com]guild wars farming[/url]
[url=http://www.guildwarsgoldmoney.com]guild wars buy[/url]
[url=http://www.guildwarsgoldmoney.com]guild wars shop[/url]
[url=http://www.guildwarsgoldmoney.com]gw gold[/url]
[url=http://www.guildwarsgoldmoney.com]guild wars gold[/url]
[url=http://www.guildwarsgoldmoney.com]guild wars money[/url]

[url=http://www.gamezmoney.com]guild wars armor[/url]
[url=http://www.gamezmoney.com]guild wars platinum[/url]
[url=http://www.gamezmoney.com]guild wars farming[/url]
[url=http://www.gamezmoney.com]guild wars buy[/url]
[url=http://www.gamezmoney.com]guild wars shop[/url]
[url=http://www.gamezmoney.com]gw gold[/url]
[url=http://www.gamezmoney.com]guild wars gold[/url]
[url=http://www.gamezmoney.com]guild wars money[/url]

[url=http://www.enjoygolds.com]guild wars armor[/url]
[url=http://www.enjoygolds.com]guild wars platinum[/url]
[url=http://www.enjoygolds.com]guild wars farming[/url]
[url=http://www.enjoygolds.com]guild wars buy[/url]
[url=http://www.enjoygolds.com]guild wars shop[/url]
[url=http://www.enjoygolds.com]gw gold[/url]
[url=http://www.enjoygolds.com]guild wars gold[/url]
[url=http://www.enjoygolds.com]guild wars money[/url]

[url=http://www.gamegoldmoney.com]guild wars armor[/url]
[url=http://www.gamegoldmoney.com]guild wars platinum[/url]
[url=http://www.gamegoldmoney.com]guild wars farming[/url]
[url=http://www.gamegoldmoney.com]guild wars buy[/url]
[url=http://www.gamegoldmoney.com]guild wars shop[/url]
[url=http://www.gamegoldmoney.com]gw gold[/url]
[url=http://www.gamegoldmoney.com]guild wars gold[/url]
[url=http://www.gamegoldmoney.com]guild wars money[/url]























[url=http://www.gw100k.com]guild wars armor[/url]
[url=http://www.gw100k.com]guild wars platinum[/url]
[url=http://www.gw100k.com]guild wars farming[/url]
[url=http://www.gw100k.com]guild wars buy[/url]
[url=http://www.gw100k.com]guild wars shop[/url]
[url=http://www.gw100k.com]gw gold[/url]
[url=http://www.gw100k.com]guild wars gold[/url]
[url=http://www.gw100k.com]guild wars money[/url]

[url=http://www.gameotl.com]guild wars armor[/url]
[url=http://www.gameotl.com]guild wars platinum[/url]
[url=http://www.gameotl.com]guild wars farming[/url]
[url=http://www.gameotl.com]guild wars buy[/url]
[url=http://www.gameotl.com]guild wars shop[/url]
[url=http://www.gameotl.com]gw gold[/url]
[url=http://www.gameotl.com]guild wars gold[/url]
[url=http://www.gameotl.com]guild wars money[/url]

[url=http://www.10minget.com]guild wars armor[/url]
[url=http://www.10minget.com]guild wars platinum[/url]
[url=http://www.10minget.com]guild wars farming[/url]
[url=http://www.10minget.com]guild wars buy[/url]
[url=http://www.10minget.com]guild wars shop[/url]
[url=http://www.10minget.com]gw gold[/url]
[url=http://www.10minget.com]guild wars gold[/url]
[url=http://www.10minget.com]guild wars money[/url]

[url=http://www.4gamefight.com]guild wars armor[/url]
[url=http://www.4gamefight.com]guild wars platinum[/url]
[url=http://www.4gamefight.com]guild wars farming[/url]
[url=http://www.4gamefight.com]guild wars buy[/url]
[url=http://www.4gamefight.com]guild wars shop[/url]
[url=http://www.4gamefight.com]gw gold[/url]
[url=http://www.4gamefight.com]guild wars gold[/url]
[url=http://www.4gamefight.com]guild wars money[/url]

Final Fantasy XIV is a Online Role Playing Game for the PS3. Final Fantasy XIV takes the first intrepid steps into an unknown realm, and in doing so a new place for adventurers of all creeds to call home is born - Erozea
[url=http://gilffxiv.com]ffxiv gil[/url]
[url=http://gilffxiv.com]ffxiv money[/url]
[url=http://gilffxiv.com]ffxiv gold[/url]
[url=http://gilffxiv.com]final fantasy XIV gil[/url]
[url=http://gilffxiv.com]buy ffxiv gil[/url]
[url=http://gilffxiv.com]final fantasy XIV money[/url]

[url=http://www.10minget.com/ffxiv.html]ffxiv gil[/url]
[url=http://www.10minget.com/ffxiv.html]ffxiv money[/url]
[url=http://www.10minget.com/ffxiv.html]ffxiv gold[/url]
[url=http://www.10minget.com/ffxiv.html]final fantasy XIV money[/url]
[url=http://www.10minget.com/ffxiv.html]buy ffxiv gil[/url]
[url=http://www.10minget.com/ffxiv.html]final fantasy XIV gil[/url]

[url=http://www.4gamefight.com/ffxiv.html]ffxiv gil[/url]
[url=http://www.4gamefight.com/ffxiv.html]ffxiv money[/url]
[url=http://www.4gamefight.com/ffxiv.html]ffxiv gold[/url]
[url=http://www.4gamefight.com/ffxiv.html]final fantasy XIV money[/url]
[url=http://www.4gamefight.com/ffxiv.html]buy ffxiv gil[/url]
[url=http://www.4gamefight.com/ffxiv.html]final fantasy XIV gil[/url]

[url=http://www.enjoygolds.com/ffxiv-gil.html]ffxiv gil[/url]
[url=http://www.enjoygolds.com/ffxiv-gil.html]ffxiv money[/url]
[url=http://www.enjoygolds.com/ffxiv-gil.html]ffxiv gold[/url]
[url=http://www.enjoygolds.com/ffxiv-gil.html]final fantasy XIV money[/url]
[url=http://www.enjoygolds.com/ffxiv-gil.html]buy ffxiv gil[/url]
[url=http://www.enjoygolds.com/ffxiv-gil.html]final fantasy XIV gil[/url]

[url=http://www.gamegoldmoney.com/ffxiv-gil.html]ffxiv gil[/url]
[url=http://www.gamegoldmoney.com/ffxiv-gil.html]ffxiv money[/url]
[url=http://www.gamegoldmoney.com/ffxiv-gil.html]ffxiv gold[/url]
[url=http://www.gamegoldmoney.com/ffxiv-gil.html]final fantasy XIV money[/url]
[url=http://www.gamegoldmoney.com/ffxiv-gil.html]buy ffxiv gil[/url]
[url=http://www.gamegoldmoney.com/ffxiv-gil.html]final fantasy XIV gil[/url]

[url=http://gilffxiv.com]ffxiv gil[/url]
[url=http://gilffxiv.com]ffxiv money[/url]
[url=http://gilffxiv.com]ffxiv gold[/url]
[url=http://gilffxiv.com]final fantasy XIV gil[/url]
[url=http://gilffxiv.com]buy ffxiv gil[/url]
[url=http://gilffxiv.com]final fantasy XIV money[/url]



All characters,items,money and Gold pieces in "RS2" are the sole property of Jagex Ltd. This purchase is not for RS2 of their intellectual property but it is merely for the time we spent acquiring the Gold Piece and getting them to you.
[url=http://www.rs15min.com]runescape gp[/url]
[url=http://www.rs15min.com]runescape item[/url]
[url=http://www.rs15min.com]runescape gold[/url]
[url=http://www.rs15min.com]runescape money[/url]
[url=http://www.rs15min.com]buy runescape[/url]
[url=http://www.rs15min.com]runescape account[/url]
[url=http://www.rs15min.com]runescape quest[/url]

[url=http://www.runescapego.com]runescape gp[/url]
[url=http://www.runescapego.com]runescape item[/url]
[url=http://www.runescapego.com]runescape gold[/url]
[url=http://www.runescapego.com]runescape money[/url]
[url=http://www.runescapego.com]buy runescape[/url]
[url=http://www.runescapego.com]runescape account[/url]
[url=http://www.runescapego.com]runescape quest[/url]

[url=http://www.runescape360.com]runescape gp[/url]
[url=http://www.runescape360.com]runescape item[/url]
[url=http://www.runescape360.com]runescape gold[/url]
[url=http://www.runescape360.com]runescape money[/url]
[url=http://www.runescape360.com]buy runescape[/url]
[url=http://www.runescape360.com]runescape account[/url]
[url=http://www.runescape360.com]runescape quest[/url]

[url=http://www.gameotl.com]runescape gp[/url]
[url=http://www.gameotl.com]runescape item[/url]
[url=http://www.gameotl.com]runescape gold[/url]
[url=http://www.gameotl.com]runescape money[/url]
[url=http://www.gameotl.com]buy runescape[/url]
[url=http://www.gameotl.com]runescape account[/url]
[url=http://www.gameotl.com]runescape quest[/url]

[url=http://www.runescape100m.com]runescape gp[/url]
[url=http://www.runescape100m.com]runescape item[/url]
[url=http://www.runescape100m.com]runescape gold[/url]
[url=http://www.runescape100m.com]runescape money[/url]
[url=http://www.runescape100m.com]buy runescape[/url]
[url=http://www.runescape100m.com]runescape account[/url]
[url=http://www.runescape100m.com]runescape quest[/url]
Feel free to contact us 24 hours a day, 7 days a week by live chat and email.
[url=   http://www.welovers.net]武汉婚纱摄影[/url]
[url=   http://www.otzg.com]寓教于乐的游戏[/url]


[url=  http://www.gamezmoney.com/dofus-kamas.htm]buy dofus  kamas[/url]
[url=  http://www.gamezmoney.com/dofus-kamas.htm]cheap dofus  kamas[/url]
[url=  http://www.gamezmoney.com/dofus-kamas.htm]dofus  kamas[/url]
12/21/2010 11:48:41 PM #
thanks for the reference dialog setup. I was looking for a quick and easy way of adding a reference dialog box and this post helped me out alot thanks
12/27/2010 7:33:29 AM #
Smallville[<a href=www.dvdtopshop.com/.../...oxset.html>smallville dvd</a> season 7 is excellent and follows the story of Clark's position to its destination to become Superman. Seven years in the show and is even stronger than ever. In perfect <a href=www.dvdtopshop.com/.../...-dvd-boxset.html>walt disney dvd</a>this season, introduces us to his cousin Kara SUPER GIRL. She brings her heritage Clark and Krypton, which is very interesting and also introduced his biological mother, Lara, and<a href=www.dvdtopshop.com/.../...-dvd-boxset.html>grey's anatomy</a> evil uncle Zor-El. This season focuses on the origins of the Clark family and krypton. There<a href=www.dvdtopshop.com/.../...dvd-boxset.html>house md dvd</a> are also some love Lana and Clark is the last time Clark and Lana head toward different paths in life. Bizzaro Lana also preferred the real deal, Clark, and triggers unpleasant <a href=www.dvdtopshop.com/.../...-dvd-boxset-.html>the closer dvd</a>clan happiness. In what is probably the biggest story of the season, which was introduced into the arc of Veritas, a secret society formed in the protection of passengers, also known as Clark. Lex also set out to find who the traveler is and destroy it.
1/10/2011 3:55:54 AM #
yeah. Is it currently possible to assign a keyboard shortcut for this?
3/21/2011 6:35:48 PM #
Keep working ,great job!
3/23/2011 6:29:59 AM #
Pretty nice post. I just stumbled upon your blog and wanted to say that I've truly enjoyed browsing your blog posts. In any case I’ll be subscribing to your rss feed and I hope you write again soon!
3/23/2011 11:36:04 AM #
Great article, hey I stumbled on to this post while searching the web for random downloads. Thanks for sharing I'll email my friends about this too.
3/23/2011 11:39:46 AM #
loved your post thank you
3/23/2011 11:46:56 AM #
Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also...
3/23/2011 5:02:46 PM #
I think your blog need a new wordpress template. Downalod it from http://templates.wordpressguru.in, The site has nice and unique wordpress templates.
Comments are closed