Archive for the ‘Tools’ Category

NavigateToTest VS extension

Monday, May 3rd, 2010

You can download the extension here:
NavigateToTest Visual Studio extension

Some time ago I blogged about the GoToTest macro I use in my daily work.

Recently I decided to create a Visual Studio 2010 extension.

Extension is convention based. It matches ClassName file with ClassNameTest or ClassNameTests and vice-versa, so you can easily navigate to the test file and back.

Here are some screenshots:

You’ll need to add toolbar manually:

Here’s the toolbar:

And two opened files:

You can download the extension here:
NavigateToTest Visual Studio extension

Editor Guidelines in VS2010

Wednesday, April 28th, 2010

In VS2008 this could be done easily, it was just required to modify the registry.

Visual Studio 2010 lacks this feature, but there is a cool plugin for that:
Editor Guidelines.

Just download, install, and put the following code in to the registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio10.0Text Editor]
"Guides"="RGB(255,0,0) 80"

Source lines of code count using PowerShell

Monday, March 29th, 2010

Source lines of code (SLOC) is a software metric used to measure the size of a software program by counting the number of lines in the text of the program’s source code.

As we all know the disadvantages of this metric, sometimes we simply want to know.

Here’s a PowerShell script, that recursively searches for *.cs files and counts the lines (empty lines and comments are excluded)

(dir -include *.cs -recurse | select-string "^(s*)//" -notMatch | select-string "^(s*)$" -notMatch).Count

Brief description of what all parts are doing:

  • dir -include *.cs -recurse : Lists all *.cs files, you can add additional extensions using a comma.
  • select-string “^(s*)//” -notMatch : Exclude comments.
  • select-string “^(s*)$” -notMatch : Exclude empty lines.

Red line at 80th column in VS

Wednesday, October 14th, 2009

vs_redline_at80There is a hidden feature in Visual Studio. You can add a nice, red, vertical line to your editor.
All you need to do is to create a .reg file with the following content:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio9.0Text Editor]
“Guides”=”RGB(255,230,230), 80″

And add it to registry (double click). That’s it!

How to permanently remove a SVN folder

Wednesday, October 7th, 2009

svnRecently I wanted to permanently remove a folder from Subversion repository.

Basically it was a folder with large amount of test data (email messages used for unit testing our Mail.dll email component), and I decided to rename every single file inside. Doing it with ‘SVN rename…’ for 3000 items was out of question.

The solution was quite simple:

First dump the whole repository:
svnadmin dump "D:\My projects\SVN Data" > dumpfile.txt

Second filter the folder I wanted to remove:
svndumpfilter exclude Mail\eml < dumpfile.txt > filtered-dumpfile.txt

Then delete and create a new repository:
Delete repository
Create repository

Finally load the filtered dump into SVN repository:
svnadmin load "D:\My projects\SVN Data" < filtered-dumpfile.txt

You can also use this procedure for upgrading SVN repository version.