Zduck

For the past week or so I’ve gone without any Visual Studio enhancements. No ReSharper. No CodeRush. I knew that I didn’t leverage even a fraction of what these tools offer so I wanted to find out what I would miss.

Here’s what I’m missing the most. In no particular order.

  1. Detection of errors before I compile.

  2. Shortcut for moving a class to its own file.

    I like to build up features in the same file (for speed) and then refactor the classes into their own files later. A tedius process of copy/paste.

  3. A rename function that is smart enough to rename the file as well.

  4. Unit Test debugger.

    I don’t mind running tests in the NUnit GUI, it even feels faster sometimes, but I miss the ability to step into my tests. I use this feature a lot for exploring APIs.

  5. Ability to generate constructors.

    Especially useful for creating custom exceptions where you want to implement all of the base constructors.

  6. Fast code snippets.

    Visual Studio’s built in snippets are functional, but slow to access compared to the alternatives so I ended up not using them. I definitely prefer CodeRush’s snippets.

Questions and comments are always welcome, just tweet @JoshuaPoehls.

Do you work from the command line? Use PowerShell? SVN?

While the SVN command line client is certainly usable, there are definitely times where a GUI is more convenient. Specifically during a commit where you want to easily check/uncheck files and view diffs.

I got tired of having to open an explorer window to get into Tortoise SVN’s commit screen so I wrote this helper function.

Put this into your profile and you can start typing tsvn commit (or just tsvn) to open the Tortoise SVN commit dialog. Enjoy!

# Helper function for opening the Tortoise SVN GUI from a PowerShell prompt.
# Put this into your PowerShell profile.
# Ensure Tortoise SVN is in your PATH (usually C:\Program Files\TortoiseSVN\bin) 
function Svn-Tortoise([string]$Command = "commit") {
<#
.SYNOPSIS
  Launches TortoiseSVN with the given command.
  Opens the commit screen if no command is given.
  
  List of supported commands can be found at:
  http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-automation.html
#>
  TortoiseProc.exe /command:$Command /path:"$pwd"
}
Set-Alias tsvn "Svn-Tortoise"

I also cross-posted this to my company blog.

Questions and comments are always welcome, just tweet @JoshuaPoehls.

Scripting Tips is an on-again-off-again series for command line fiends. I’ll try to keep these short and sweet. To dig a ‘lil deeper you can find me on Twitter.


I’ll cover these prerequisites in brief, but for this tip I’m going to assume a few things:

  • You are running Windows and have PowerShell installed.
  • You are familiar enough with PowerShell to care about your $PROFILE.

What is PowerShell?

In short, PowerShell is a new scripting language from Microsoft designed to replace the use of batch files and VBScript for administrating and automating Windows machines. The language leverages the .NET Framework such that anything you can do with .NET you can do with PowerShell. Typically you will be using PowerShell from the command line but there are lots of other ways to use it.

What is a PowerShell profile?

PowerShell has the concept of a script that will run each time you launch PowerShell. This is a really handy place to put any functions that you want to be available all the time. Initialize some variables, create some aliases, anything you do here will be there when you need it.

What are we doing here?

I’m going to give you one possible solution for keeping all of your scripts and settings (i.e. your profile) in sync no matter which computer you are on. No copy/pasting. No more wearing that USB dongle around your neck - seriously, that just screams geek.

Most steps have a sample PowerShell command that will do the trick. So fire up PowerShell and put on your scripting hat ‘cuz here we go!

  1. Get Dropbox.
    Among other things, Dropbox makes keeping your files in sync across computers dead simple. If you aren’t using it you should be. It’s just that good.

  2. Create a folder in Dropbox to hold your scripts.

    PS> New-Item $dropbox\scripts

    Anywhere you see $dropbox, assume this to be the path to your Dropbox folder. By default on Windows 7 this is %USERPROFILE%\Dropbox.

  3. Copy your profile ps1 file into your new scripts folder.

    PS> Copy-Item $PROFILE $dropbox\scripts\profile.ps1
  4. Edit your profile ps1 file (the original one) and “dot source” the one in your Dropbox folder.

    PS> ". $dropbox\scripts\profile.ps1" > $PROFILE

Pro Tip! As an alternative to dot sourcing your profile from Dropbox, you could instead create a symlink to it.

PS> fsutil hardlink create `"$PROFILE`" `"$dropbox\scripts\profile.ps1`"

I also cross-posted this to my company blog.

Questions and comments are always welcome, just tweet @JoshuaPoehls.