Visual Studio Addins – SmartPaster and CopySourceAsHTML

In a recent presentation I mentioned two addins for Visual Studio that I love. I checked and was happily surprised they had been updated for Visual Studio 2008.

The first of these is SmartPaster. With SmartPaster you select some text, then come to Visual Studio, right click and pick “Paste As…” You’re then given four options: Comment, String, StringBuilder, and Region. I find the String or StringBuilder options very useful. When I write SQL I usually do it over in SQL Server Management Studio, I then come to my app and want to paste it in. This saves me from having to put all the quotes and concatenation, a huge time saver. Comment is also handy, I often type up a bunch of comments in a text editor, then want to paste them in quickly and easily. This takes care of line wrapping, etc.

The second tool is an essential one for any blogger: CopySourceAsHTML. It’s pretty simple, highlight a bunch of code, right click and pick “Copy As HTML…”. A dialog pops up that gives you some option to tweak the code. You can over ride the default font, font size, tab size, and other handy things. I use this for all my blog posts, I find it’s the easiest way to get the most accurate syntax coloring.

Installing either addin is very simple, extract the zips, then just navigate to your C:\Users\<username>\Documents\Visual Studio 2008\Addins folder (create it if it doesn’t exist) and copy the appropriate files in there and restart Visual Studio 2008. See the respective websites if you need more detailed info.

If you are still on Visual Studio 2005, there are 2005 versions of these addins as well, available from their sites.

Gentleman, JumpstartTV Your Engines

Thought I’d spread a little link love today, and to start with I will point you to the http://jumpstarttv.com website. JumpstartTV hosts short training videos with one very specific, focused topic per video. When I say short, I mean short. Three to five minutes is the goal for each video. I was honored recently when asked to participate in the site, and have created a series for them on SQL Server Full Text Searching. The first video on installing was featured yesterday, but you don’t have to wait for the videos to be featured, you can see all of them by jumping to my JumpstartTV profile.

One thing to note, you will be asked to create an online profile. This is free, and it turns out very useful. You can use it to track all of the videos you watched. This makes it very convenient to come back later and refresh yourself on something you learned. In addition, the site has a “watch it later” feature. You can go all over the site picking out videos you think would be interesting and clicking the “watch it later” link. Then when you go to your profile, you’ll be able watch the selected videos one after the other. JumpstartTV has videos on both SQL Server and .Net, as well as some interesting ones in the “Misc” category, including bartending, self defense, and more.

The second link for the day is an interesting article on the simple-talk website, “Taking Back Control of your IT Career”. It was written by a friend of mine, Stephan Onisick and chronicles his ordeal of getting laid off from his company of seven years, through a period of retraing himself and ultimately landing a new job that met the needs he set out. Even if your company is nice and stable, you will find good advice for keeping your skills up in this article. Disclaimer, he does mention a presentation I did in the article, but in spite of that it’s still a good read. 😉

Next is a new SQL Server resource brought to us by the fine folks at Quest Software, it’s the new SQLServerPedia. The site is both a wiki and a series of podcast like videos you can subscribe to from your Zune or other music player. I have my Zune setup to automagically download new episodes as they come out. I believe it was @BrentO himself who clued me in on the site.

I’ve written in the past about CodeRush, the tool I refuse to code without. Well the wonderful folks at Devexpress have created a free version called CodeRush Xpress for Visual Studio. Now if you need to code on a budget, you can still enjoy CodeRushy goodness in your 2008 IDE! And it’s not even Christmas yet!

Many of you follow me on Twitter, if you don’t I’d love to invite you, I”m on as @arcanecode . Guy Kawasaki has a great article on How To Pick Up Followers on Twitter. Good article that shows some of the strengths of Twitter, and how to use them to everyone’s advantage.

Speaking of Twitter, thanks to @theronkelso I found a new service called TweetLater. This service lets you schedule a tweet to be delivered to Twitter at a later time. For example, I would like to be able to tweet that our BSDA meeting is about to begin. But as the current President I’m usually up front introducing the guest speaker, and thus not at a keyboard. TweetLater to the rescue, I can set it to auto post the meeting is starting and be in two places at once.

It’s also great as a reminder tool, I can queue up meeting reminder tweets for the entire year ahead of time and forget all about it. Another feature, you can set it to auto reply with a message to new followers, and it can even be setup to automatically follow anyone who is following you. I believe this is a resource I’ll be using a lot.

The next to final link is a reminder really, to the Alabama Tech Events site. This is a community site for posting technical events of interest to folks in the state of Alabama. Please note that the event doesn’t have to be in Alabama, just of reasonable interest to folks in the state. We’ve posted events in Tennesee, Mississippi, Florida and Georgia. If you have a technical event contact me or one of the other user group leaders to get it added.

I’ll wrap up today’s link lovefest with the site analogous to the Alabama Tech Event site, but for the entire country: Community Megaphone. This site lists events from all over the United States. You can filter by state or event type.

BarCamp Birmingham 2 Presentations

At last Saturday’s BarCamp Birmingham, I gave three presentations. The first was on Virtual PC 2007. For more info on it just look to my previous post, which has the first video on VPC. I’m currently working on the other videos in the series and should have them up this week.

My second presentation was “The Developer’s Experience”. As promised in the session, here’s the complete PDF of my slides: The Developer Experience. This has hyperlinks to all of the tools I presented.

My final presentation was on Full Text Searching on SQL Server 2005.  First, here is a PDF of the PowerPoint slides: Full Text Search Power Points

Next, most of the demos used SQL statements. This PDF file has all of the SQL plus some associated notes. Full Text Search Demo Scripts

Finally, I didn’t get to demo this at BarCamp due to time, but I do have a WPF project that demonstrated how to call a full text search query from a WPF Windows application. Annoyingly enough WordPress (who hosts my blog) won’t let me upload ZIP files, so I renamed the extension to pdf. After you download the file to your drive, remove the .pdf and put the zip extension back on, then it should expand all the source for you correctly. (Yes, I know, I really need to get a host server for binaries, one of these days I’ll get around to it, but for today…) Source for WPF Demo

See you at the next BarCamp!

The Developer Experience

In case you’re wondering why the slowdown in the blog this week, I’ve been spending all my free time getting ready for Alabama Code Camp 6. My first presentation of the day is “The Developer Experience”. It’s chock full of practical, low cost (or even free!) ways to make your life as a programmer more productive.

As promised in the session, here’s the complete PDF of my slides:  The Developer Experience

Does MacGyver Dream of Mark Miller?

For Christmas this year my family gave me a copy of MacGyver, Season 1 and 2 on DVD. My wife’s side of the family gave me a gift card which I used to get seasons 3 & 4. I’m a long time MacGyver fan, but my wife had only seen one or two episodes and my kids had never seen it at all, so we’ve been having a lot of fun watching. My favorite part of the series was the voice-overs, where you’d hear MacGyver’s voice as he explained what he was doing. It always started with some odd thought or story that led you through the thought process of how he came to the conclusion to build whatever wacky life saving device he was constructing.

I’ve come to realize in some ways these blog entries are sort of like the MacGyver voice-overs, my inner thoughts being created for you on the web. So I hope you’ll bear with me a few minutes while I relate a rather bizarre dream I had last night.

In my dream I’m standing on stage, in front of a fully loaded computer. It has all the bells and whistles, VS2008, SQL Server, and so on. On the other side of the stage, Mark Miller is there, in front of a similar computer. For those unfamiliar with Miller, he’s the genius behind CodeRush and RefactorPro, tools to help you write code faster. Some time back, when the product was first released Miller used to challenge the audience to beat him in a code writing contest. His machine had CodeRush, and he would use chopsticks to write code, his competitor could use their fingers but did not have CodeRush on their machine. Of course Mark always won.

So sure enough, in my dream there’s Miller, chopsticks in hand ready to go, and I’m the guy going up against him. Our task is to take data from table A1, create a mirror table and name it table A2, and then move all million rows from A1 into A2. As you might guess, in my dream, I win. How?

Well I didn’t write a program. Instead I first jumped into SQL Server Management Studio (SSMS) and used its script generating capability to produce a create table script. Make a quick search and replace and boom I’ve got table A2 created. I then jump over to the Business Intelligence Developer Studio (BIDS) to create a SQL Server Integration Services (SSIS) package to do the data move. (Yes, I probably could have used the script generation of SSMS again to generate an Insert script, but I was showing off.) In about three to four minutes I had accomplished the task and moved all the data while Miller was pecking away at computer with his chopsticks.

I didn’t win because I’m a hot shot coder who is smarter than my competitor. Miller is a (some say mad) genius who can run circles around me in the coding world. As I told the folks in my dream, and I’m telling you now sometimes the best solution to a programming challenge isn’t to program at all! If you read yesterday’s post, Straining at Gnats, you may recall I said “…take some time. Push back from your computer and think for a moment. Think what the true outcome of your application is supposed to be. Not “what will the program do” but “what will the program do for the user???” Think about how best to achieve the user’s goals.

When you are thinking about solutions, take a minute to look outside of your favorite programming language. Is it possible to achieve the goal without writing any code at all? What tool or tools do you have in your tool box that you can combine to get the job done? Here’s a great example that happened to me just before I took off on my holiday vacation.

As I’ve mentioned before at work we have a Business Intelligence (BI) app I work as the lead on, it imports data to a SQL Server 2005 warehouse via SSIS then uses SQL Server Reporting Services (SSRS) to generate reports. The data is imported from a work order management system we bought many years ago. We also have some engineers who have a tiny little Microsoft Access database. This database has a primary key column; we’ll call it a part number for purposes of this example. There are three more columns, some data they need to know for each part but are not found in our big system. They’d like to add this data to the reports our BI app generates. Two last pieces of information, they only update this data once per quarter. Maybe. The last few years they have only done 3 updates a year. Second, the big system I mentioned is due to be replaced sometime in the next two years with a new system that will have their three fields.

A lot of solutions presented themselves to me. Write an ASP.Net app, with a SQL Server back end then use SSIS to move the data. Elegant, but a lot of work, very time consuming for a developer, especially for something that can go away in the near future. Write an SSIS package to pull data from Access? Risky, since we had no control over the Access database. A user could rename columns or move the database all together, in either case trashing the SSIS. Several other automation solutions were considered and rejected, before the final solution presented itself: not to automate at all.

Once per quarter I’ll simply have the engineers send me their Access database. Microsoft Access has a nice upsizing wizard that will move the table to SQL Server, I’ll use that to push the data onto the SQL Server Express that runs on my workstation. I’ll then use the script generating capability of SSMS to make an Insert script for the data. Add a truncate statement to the top to remove the old data and send it to the DBA to run. When I ran through it the first time my total time invested was less than ten minutes. In a worst case scenario I spend 40 minutes a year updating the data so it’s available for reporting. That’s far, far less time that I would have spent on any other solution.

The next time you have a coding challenge, take a moment to “think like MacGyver”. Look at all the tools you have lying around your PC and see what sort of solutions you can come up with. Once you are willing to step outside the comfort zone of your favorite coding language, you may be able to come up with some creative, MacGyver like solutions to your user’s problems.

 

PS – If you missed the announcement while on vacation, DevExpress just released CodeRush / RefactorPro 3.0. More than 150 refactorings and lots of new CodeRush features! Update yours today.

Arcane Fun Fridays

WHEW! All of this WPF / XAML sure has been a lot of fun. But I think it’s time to come up for air and see what else is happing out there in Dot Net land.

Alabama Code Camp is coming up in just a little over a week, Saturday October 6th to be exact. Still plenty of time to register and even just a bit of time if you want to get in on the Silverlight programming contest. First prize for that is a Zune! http://www.alabamacodecamp.com/home.html

devLink, the large conference for a cheap price comes up right afterward in Nashville, Friday and Saturday October 12th and 13th. http://www.devlink.net/ . You can tell I’ll be there, my name’s on the front page as a winner of a Barnes and Nobel gift card (look for the dude from AL !)

(By the way, anyone know of a good dog repellent? My nephew is coming to house sit and is bringing Marshmallow and Buttercup, his twin Dobermans along because I have a big back yard they can play in. Last time though they ate the garden hose, chewed the handle off my shovel, and bit through one of my lawnmower tires.)

There’s a new add-on for SQL Server Management Studio I’m eager to try out. It’s still in Beta but looks promising. It was blogged about at http://weblogs.sqlteam.com/mladenp/archive/2007/09/20/SSMS-Tools-Pack—an-add-in-for-SQL-Management-Studio.aspx or you can download it directly at http://www.ssmstoolspack.com/ .

If you are a fan of NUnit, you’ll appreciate the new xUnit. Read James’ announcement at http://jamesnewkirk.typepad.com/posts/2007/09/announcing-xuni.html .

In a recent Dot Net Rocks episode, Carl Franklin announced they would be taking over Shrinkster.com. Shrinkster has been down due to spam abuse, as soon as Carl gets everything setup we’ll be able to go back to using short links again!

Speaking of Dot Net Rocks, I especially enjoyed show 274, where the new features of VB.Net and C# for the 2008 release were discussed. Entertaining and lots of good tidbits. I think my favorite feature so far has got to be C#’s extension methods. http://www.dotnetrocks.com/default.aspx?showNum=274

During my long drive to the Tallahassee Code Camp last week, I put together a podcast theme session, and copied a bunch of related podcasts onto my cheapo SanDisk mp3 player. This time I went with a “Millenator” theme and got all the episodes of Dot Net Rocks that Mark Miller appeared on. Good stuff, lots of thoughtful material combined with some humor. Next time you go on a trip, copy a bunch of past episodes of your favorite podcast that are in the same theme and make that long drive go much quicker.

There have been several updates to the world’s greatest Visual Studio Add-In, CodeRush, over the last few weeks ( http://www.devexpress.com/Home/Announces/CodeRush25.xml ). Apparently Mark Miller and the boys have been busy! If you’re not on 2.5.4 go update yours today.

Speaking of Mark Miller, I love his intro slide for his VSLive session coming up in LasVegas. Take a look, pure genius. http://www.doitwith.net/2007/09/11/MyLastVSLiveSessionEver.aspx

A final note, between getting ready for Alabama Code Camp and going to devLink my blogging may get spotty for the next few weeks, bear with me and I’ll have full reports from both code camps and lots of fun new stuff to share.

New version of CodeRush/RefactorPro

Just thought I’d take a short break from WPF to make you aware there has been a new release to that wonderful Visual Studio add-in CodeRush. The product has now broken the 100 refactorings mark!

You can read the announcement from DevExpress at http://www.devexpress.com/Home/Announces/CodeRush25.xml

If you are not familiar with DevExpress’ CodeRush/RefactorPro tools, you can read my original post at https://arcanecode.wordpress.com/2007/01/09/visual-studio-add-ins-coderush/

The new version already works with Visual Studio 2008. Talk about being on the ball, VS2008 is still in Beta and they’ve already got refactorings out there just for it!

Arcane Add-Ins: KNOCKS Solutions VS 2005 Add-In

It’s been a while since I talked about Visual Studio add-ins, so when I ran across KNOCKS Solutions “Knocks VS2005 Add-In”, I knew I’d found the perfect subject. Available at http://www.knocks-solutions.com/VS2005Addins.aspx?sm=idVS20052 , this rather full featured add-in offers many utilities.

First is a personal clipboard, that allows you to store and retrieve up to 9 different items. And they’re persistent, they will stay between VS sessions.

Next is a code snippets manager. This seems a bit redundant in light of VS 2005’s snippets, but I can see it being very useful during a presentation.

In addition to the code snippets is a Notes module. I’ve often wished for the ability to store quick notes to use in a presentation, so this is a handy module.

Up next is the one tool of theirs I have a beef with, the “Re-arrange code” tool. I like the idea of being able to re-arrange my code. Often I’m working on some public method, and realize I need a private helper method and, being in a hurry and lazy, will drop it right under the public method. Later I’ll move it around, which was why I was excited to see this tool.

Sadly, it has a really bad side affect, it strips out any regions you’ve put into your code, and it strips out any comments that might lie between methods (I often put a comment header right above my method, instead of in the method.) When Knocks rearranges your code all of that goes into the bit bucket, making the tool useless in all but (perhaps) the very earliest stages of coding. I would have thought it possible to add regions to the tool as well, and allow code rearranging within a region, between regions, or even to move regions around. Perhaps this will be addressed in the next version (he said, ever full of eternal hope).

There is a nifty zip tool that will zip your entire project, handy for quick backups. Also is a tool that embraces the concept of a favorites for projects. Another tool is one I wonder why no one did sooner, a keyword search on Google (or other configurable search engine, like MS Live). This is one I’ll be using often.

Also included is a simple “Data Object” generator. You bring it up and enter a few property names and types and Knocks will create the basic class for you. While I have seen more full featured code generators, I appreciate the basic simplicity of this one, not to mention the price (which I’ll get to shortly).

knocks01The final two tools I’ll mention are my favorites. First is a Design Explorer. This adds an explorer window (I put mine with the Solution Explorer area) to your display. In it are all the controls for your current form. Clicking on the control not only makes it the active control in the designer, but displays the properties in the lower half of the Design Explorer window.

 

 

 

 

 

 

 

 

 

knocks02The other tool is the Code Explorer. It displays a tree of your current code module. Double clicking on the code element will take you to it in the code window.

I’ve seen other add-ins with code windows, this one seems equal in functionality with many others similarly priced.

 

 

 

 

Oh, did I forget to mention the price? It’s free. Yes, FREE. Knocks has packed a lot of functionality into this add-in, and the fact it’s free makes it well worth the time to download and learn.

Arcane Holiday

Today in the US we are celebrating Memorial Day, where we remember all of the soldiers who fell in battle. So let me first start by thanking the families and those men who sacrificed themselves for the greater good.

In keeping with the holiday theme, I thought I’d take a brief holiday from the Windows Services series and catch up on a few things.

First, there’s been an update to my favorite Windows add-on, TouchCursor. The new version fixes the issue I mentioned with Virtual PC’s. The only issue since I’ve run across is in using it with Visual Studio and DevExpress CodeRush add-in. CodeRush also wants to use the spacebar for activation. However, I was able to easily change the activation key from CodeRush to something else, and problem was solved. Check it out at http://touchcursor.com/ or see my initial review at http://shrinkster.com/pf4 .

Next, about a week ago I mentioned some great music to program to by a group called Midnight Syndicate. Shortly after posting I found out the Haunted Voices Radio podcast did an entire weekend of Midnight Syndicate, including playing their music and complete interviews. Check out Haunted Voices Radio at http://www.hauntedvoicesradio.com/modules.php?name=Content&pa=showpage&pid=6 or http://shrinkster.com/pf2 . Each banner ad is to a separate MP3 (the weekend was broken up into 2 hour chunks for easy downloads). I believe there are 17 in all.

Finally I have to confess to a guilty pleasure. I recently received a gift certificate to a book store, and used it to purchase “Windows Developer Power Tools” by James Avery and Jim Holmes. (Amazon link: http://shrinkster.com/pf5 )

If you’ve been reading my blog for a while you know I’m a “tool freak”, I love add-ins and tools for Windows and Visual Studio. As such I’ve been wanting this book for a while, but since I’ve already got a huge stack of books I’m still reading through I was having problems justifying yet another book. The gift certificate gave me just the opportunity I needed to get this cool new book. At over 1200 pages it’s chock full of toys, can’t wait to dig in!

VS Add-In: Oracle Developer Tools for Visual Studio.Net

I found a useful and important add-in for those who deal with Oracle databases using Visual Studio. Oracle Developer Tools for Visual Studio.Net. ODT for VS adds an Oracle Explorer, similar to the Data Explorer built in to VS. It has an incredible amount of functionality built in.

I already mentioned the Oracle Explorer, which gives you a tree that lets you examine your tables (and columns), views, stored procedures, packages, sequences, and all of the other objects Oracle supports.

There’s a plethora of designers and wizards that will allow you to create and alter the aforementioned objects. They work by generating SQL that you can preview before it’s applied.

The feature I find most useful is the PL/SQL editor. Right inside VS I can now write my stored procedures. But what’s really powerful is I can set a breakpoint, and step from my VB.Net or C# code right into the stored procedure, step through the stored procedure, then back into my application. THAT is useful.

You can obtain ODT for VS directly from Oracle, at no cost. http://www.oracle.com/technology/tech/dotnet/tools/index.html or http://shrinkster.com/lry.

I did run into one issue after the install. Oracle installs it’s ODP driver and creates a new Oracle home for your machine. In order to make the connections I had to copy my tnsnames.ora, ldap.ora, and sqlnet.ora files from my old oracle home to the one for 10.2, by default it’s in C:\oracle\product\10.2.0\client_1\network\ADMIN. I found this solution and some other interesting tidbits at the FAQ: http://www.oracle.com/technology/tech/dotnet/col/odt_faq.html or http://shrinkster.com/ls0.    

I’m not going to regurgitate a lot of how to here, instead I’ll refer you to a good article on the Oracle site, at http://www.oracle.com/technology/oramag/oracle/06-sep/o56odp.html or http://shrinkster.com/lrz. This article has the basics to get you up and running.

If you work with Oracle databases, this is a must have add-on for your Visual Studio environment.

Visual Studio Add-Ins: CodeRush

Every so often a software package comes along that drastically changes your life. Makes it easier, makes you more productive, and is fun to use. For me, that product was CodeRush.

CodeRush is a code authoring tool that works with both the 2003 and 2005 versions of Visual Studio .Net. Note I say code authoring, not code generating. With a code generator, you give it some input and it whirs and grinds and boom out comes a big hunk of code.

CodeRush on the other hand helps while you are writing code. For example, let’s do something like a C# switch statement. First, let’s see we have a parameter passed in named Switcher. I’ll set a local variable to it:

      int localSwitch = Switcher;

Next, I’ll copy the localSwitch variable to the clipboard. Now I’ll type in the word switch, and hit space. When I do, this is what you’ll see:

      switch (localSwitch)

      {

        case 0:

 

          break;

      }

CodeRush made the assumption since I had a variable already in the clipboard, that’s probably what I wanted to switch on. It then constructed the basic swich for me, including braces, my break and what you see above. It also placed my cursor right on the L in localSwitch with the variable highlighted, so that if it’s not what I wanted all I have to do is start typing.

That’s just one example, CodeRush has hundreds of built in templates that will make your coding faster. In addition, when you buy CodeRush you also get it’s sister product RefactorPro. RefactorPro makes that critical refactoring stage of development so much nicer.

Let’s take a tiny example. Suppose you need to change the order in which two parameters occur in a method. Not only will RefactorPro simply let you drag one parameter in front of the other, it will then search through your code and automatically update all references to the method for you.

There are way more features then I could cover in a single, or even a week’s worth of blog posts. Instead, I want you to go look at their training videos, which you will find here:

http://www.devexpress.com/Products/NET/IDETools/CodeRush/training.xml

or http://shrinkster.com/jx0

There’s no charge to watch, no special software, and they’ll give you a great idea on what CodeRush and RefactorPro can do for you.

For a complete product overview you can visit:

http://www.devexpress.com/Products/NET/IDETools/CodeRush/Index.xml

or http://shrinkster.com/jwz

If you asked me what could I name that was negative about the product, about the only thing I could point to is the price. At $250 (US) it’s not cheap. However this product has saved me so many hours it’s well worth the money. If you work for even a small company it shouldn’t be a great effort to get them to cover the cost.

If you asked me what the best thing was, I’d say the support. Developer Express runs it’s own news server, and the developers are right in there as often as they can, answering questions, and asking the users what features they want in the next release. I’ve never seen any company provide the level of support DevExpress does with this product.

The best part of all this is you can discover CodeRush for yourself, for free. You can look at the training videos and newsgroups, then download an evaluation version which you can run with no restrictions (it’s not crippleware). Last I checked they asked you to send an e-mail to their support staff and they’d send you the details.

CodeRush is a great tool that I can’t recommend enough. It has made me so much more productive, and with a minimal amount of effort I think you will be to.

Standard disclaimer, I don’t work for DevExpress, make no money off sales, or receive any compensation what so ever, I just think it’s a cool developer tool!

Yes Virginia, There Is A Mark Miller

My favorite, all time Visual Studio add-in is DevExpress’s CodeRush. I haven’t had time to do a good blog entry on it, but if you are looking to buy yourself a Christmas gift, this would be an excellent choice. (http://www.devexpress.com/Products/NET/IDETools/CodeRush/Index.xml)

DevExpress’s CTO of developer tools and grand poobah of programming is a C# MVP named Mark Miller. Mark has made many appearances on Dot Net Rocks (http://www.dotnetrocks.com) and DNR TV (http://www.dnrtv.com). His appearances are always informative and educational. He has a unique way of looking at the world that will make you think about programming (and other things) in new ways.

Mark just blogged (http://www.doitwith.net/2006/12/23/ChristmasCancelledAgain.aspx) that he’s got a quick feature he’s adding to the new version of CodeRush, and there’s a possibility it could be ready for Christmas Day.

Yes Virginia, there is a Mark Miller!

UPDATE: I finally got around to writing about CodeRush, you can read it here:

https://arcanecode.wordpress.com/2007/01/09/

Customizing Visual Studio – Shortcuts to Commands

One of the great things about Microsoft is the way all of their stuff is extensible. For years folks have been writing macros, add-ins for the office tools. In case you hadn’t noticed, Visual Studio is just as extensible as the rest of the Microsoft tools.

In this first article, we’ll look at making a shortcut to a handy VS command. First, we’ll need to fire up SlickEdit Gadgets Command Spy tool. What? You haven’t installed it yet? OK, go read my blog posting from November 14th (https://arcanecode.wordpress.com/2006/11/14/visual-studio-add-ins-slickedit-gadgets/ ). The rest of us will wait.

Back now? Great. OK, as I was saying fire up Command Spy. You’ll see it’s window appear, just slide it to an out of the way space, or dock it. In this example, we’ll want to create a shortcut toolbar to collapse and expand all of our code regions with one click.

There’s already a menu option to do this, click on Edit, Outlining, Collapse To Definitions. (Note if you don’t see the Outlining option, make sure you’ve clicked in the code window.) Glancing down at the Command Spy window, you will see that the command issued was Edit.CollapseToDefinitions.

[CommandSpy First Command]

Great, jot that down, and let’s run another command. Click on Edit, Outlining, Toggle All Outlining. You’ll see a new command has shown up in Command Spy.

[CommandSpy with Second Command]

Edit.ToggleAllOutlining is what we are looking for here. Now that we have the commands we want, let’s create a toolbar and hook them in.

Right click in the toolbar, and select Customize. In the Customize dialog, click on New. Give your toolbar a good name, it’s also helpful if you use something like your name to distinguish it from the rest of the built in bars. I named it ArcaneOutlining. You’ll see your new toolbar pop up to the right of the Customize window. (The red arrow is pointing at it.)

[Create a new Toolbar window]

I’m now going to drag the new toolbar under the Customize window, just so it will look decent for the next screen capture.

Now we need to drag our commands onto the toolbar. Click on the Commands tab of the Customize window. Under Categories, scroll down to Edit. Now in the Commands list area, scroll down to Outline Toggle All, and drag it onto the toolbar. Then, pick Outline Collapse to Definitions, and drag it into the toolbar. In this shot, you’ll see what it looks like when you’re done.

[Customize the toolbar window]

OK, we now have our commands, but all that text looks pretty ugly. Right click on the Outline Toggle All command, and you’ll get a menu. Click in the Name area, and you can type over the name of the menu option. I’m going to replace Outline Toggle All with + (a plus sign).

[Rename menu]

Once done, close the Customize dialog, then you can drag your toolbar to an appropriate spot. Use the – button to collapse everything, and the + to toggle it back.

[Picture of our new toolbar]

While I’ve picked out some specific commands, you can use this technique for any command that Visual Studio can produce, and create your own customized toolbars.

Visual Studio Add-Ins: VSFileFinder

If you tend to organize everything in your projects using file names, then you will love this add-in. VSFileFinder, available at http://www.zero-one-zero.com/vs/, adds a simple window to your Visual Studio environment. I elected to dock this window in the bottom center, where my output sits. There’s a text box across the top and a list box under it.

[Picture of VSFileFinder]

 

The text area lets you key in a file name (or part of one) to filter off of. The list area shows all the files in your project that match the entered filter. Clicking on a file will let you open it, or if already open will bring it to the foreground.

As you can see, entering “fo” matched all my Form1 files. Interestingly enough it also matched AssemblyInfo since it also contains “fo”.

That’s about it, VSFileFinder is a simple, one task tool that adds one specific type of functionality. But it does it well, and for free!

 

Visual Studio Add-Ins: Cool Commands 3.0

Update Feb. 9, 2008: Version 4 is now out, but there’s no new blog post. Follow the link below and scroll down through the comments to find the link to version 4.

Another handy add-in that brings functionality to the Solution Explorer is CoolCommands. Version 3 is available from http://weblogs.asp.net/gmilano/archive/2006/05/10/446010.aspx, and adds a whole series of new menu commands to the right click menu in the Solution Explorer window. It also adds a few new menu command to the Code Editor window. Since the site doesn’t do a great job of documenting all the features in the current release, here is a brief list of all the commands that get added.

Commands for the Code Editing Window

DemoFont – In the edit window, right clicking has a new menu option called DemoFont. This will let you quickly toggle back and forth to a larger size of the font you’ve been running. Clicking again will return you to the font size you previously had.

Wheel Font Zooming – My guess is this lets you use the mouse wheel to adjust the font size, but it didn’t work on my system. However the other commands are so useful I’m willing to overlook one dud.

Open File – This is very cool. Within comments you will sometimes see something like “// See the class file Xyz.cs for more info”. With cool commands, you simply right click on Xyz.cs and pick Open File, and that file will open in VS.

Commands for the Solution Explorer

Collapse All Project – Simple menu option to collapse all the projects in your Solution Explorer’s tree.

Command Prompt Here – Opens a command window in the directory where the project sits. (Only appears when clicking on a project).

Open Container Folder – Opens a Windows Explorer where the current file happens to reside.

Reference Manager – Lets you manage the references for the solution.

Resolve Project References – Validates all of your project references.

Copy and Paste References – Lets you create a reference for one project and paste it into another project. Makes setting up references between projects nice and easy.

Add Projects From Folder – Allows you to easily import one or more projects that are stored in a folder.

Commands for the open files tabs

Locate in Solution Explorer – This is cool, in the little tab markers at the top of the editing window, right click and pick this option. The solution explorer will then highlight the file for you.

One thing to note, technically CoolCommands is not an Add-In. While it adds new menu options, it cannot be loaded or unloaded from the Tools, Add-In Manager.

This free tool adds some nice functionality to your VS environment, and is well worth the download.