You are currently browsing the category archive for the 'Tools' category.

AnkhSVN

A mate came on me with “I found a wonderful SVN client which works from Visual Studio. It’s called AnkhSVN“. When I tried it last time it was in version 1.x, ugly & buggy. Having a well working TortoiseSVN I had no regrets uninstalling it.

Lately it passed a major update. It looks nicer, integrates well in VS and has all functions required for day-by-day work with Subversion. The mate who recommended it said that he found no problems during a week of trying it.

Ok. Having a refactoring to do that will involve moving few files I decided to give it a try. Moving/renaming files is one of the pain points when working with TortoiseSVN. After committing my changes to repository, the TeamCity server failed to build the project – few files was missing or had unmodified content when it should. AnkhSVN didn’t committed all changed files to repository. In VS they was shown as unmodified, but TortoiseSVN show them as changed files. A commit from TortoiseSVN has fixed the problem.

Still in doubts about it, worth keeping or not…

 

MBUnit Plugin for Resharper

I wanted to run test suite of Rhino.Mocks which uses MBUnit. First try – installed last version of MBUnit plugin for Resharper. It worked nice when I run a single test fixture. But failed to find any tests when I choose “Run Unit Tests” from context menu of a project or solution. Uninstalled.

 

Gallio Automation platform

Still wanted to run the Rhino.Mocks’s unit tests, installed Gallio a bundle that contains among others the MBUnit, a standalone test runner and yet another MBUnit integration into Resharper’s Test Runner. Results:

  • Integration with Resharper: didn’t discovered all test from test project, cannot run those discovered.
  • Standalone test runner – cannot run test suite, FixtureExecutionException.

The last two tools concerns MBUnit. All I wanted to do is just to run quickly a test suite. I can do it from console, but it’s painful and I want to do it from VS and have results there. I can do it with TestDriven.NET – but I don’t like it because found it too intrusive in my work environment. I think this is the reason why we haven’t moved to MBUnit from NUnit. It’s it superior as unit test framework, but weak tooling support make it unusable for us.

& no time now to check what is not working and how to fix it. May be later…

PS: I’ve seen it one more time: It’s very important the very first impression about something to be positive. If somebody tries your software and it blows up or doesn’t do what is it about, you fail. But this is another story…

After installation on my Vista box, TortoiseSVN cannot start, giving an entry in event log that says:

Activation context generation failed for “C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe”. Dependent Assembly Microsoft.VC90.CRT,processorArchitecture=”x86″,publicKeyToken=”1fc8b3b9a1e18e3b”,type=”win32″,version=”9.0.30411.0″ could not be found.

At first sight, the missing “Microsoft.VC90″ points to absence of Visual C++ Redistributable Package. Installing all of his versions didn’t help. After trying to work out this error, it magically disappeared and TortoiseSVN started successfully and worked well…

…until today, when I’ve upgraded to 1.5.2. Same error. Didn’t want to start. Now on two PC’s from office.

After searching for solution, found on a TortoiseSVN’s discussion lists a recipe that worked OK for me. I’ll cite it here with explanation, is given by Stefan Küng, one of TortoiseSVN developers:

try this:
uninstall TSVN, reboot, install it again.

There’s a problem with the new CRT merge module from MS: it does not recognize always that is has to update itself.

The good old way: uninstall, reboot, install. So windows95-ish.

This time it’s about useful macro that speeds up writing test names. Although we’re not using yet BDD development style (BDD is for Behavior Driven Design) I like to give to my test BDD-style names. You know, something like

[Test]
public void When_user_pressed_OK_message_should_be_prepared_and_sent()
{
}

Writing down these names, when words are separated by underscores is not easy and error prone.

Fortunately, Jean-Paul S. Boodhoo has posted in his blog an updated macro for formatting test names in BDD-style manner:

Using this macro you can write test name as an usual sentence, having words separated by spaces. After running the macro it will replace all space characters by underscores.

For me it was first macro written for Visual Studio, but after some rambling within VS I have the macro running and working well. Thereafter, found these links than can help to setup and use VS macros:

I have shown today few tricks with ReSharper to one of my teammates. I think it worth to be shared/stored in the blog.

1. View the code used from a referenced assembly

Very often you want to see how a referenced assembly is used in your project. We can use dedicated tools to work this out (for example, NDepend) or you can just click on a project in solution explorer, expand “References” node, select an assembly, right-click and select “Find Dependent Code“. You will see a nice “Find Results” window with all places where this referenced assembly is used.

Same way, you can analyze project dependencies in a multi-project solution. I think you will be rewarded in future if your presentation assemblies will not depend from a project with database stuff.

2. Setting a keyboard shortcut to run a unit test

I’m sure that any keyboard ninja knows it. Do you want to learn a bit of kung-fu? Go to keyboard settings configuration in Visual Studio (Tools > Options… > Environment > Keyboard), find a command named “ReSharper.UnitTest_ContextRun” and assign a shortcut to it. I hang it to “Ctrl+1″.

Now, when you’re editing a class containing unit tests, you can just press your newly created shortcut and ReSharper will run the tests: if you’re inside a test method (method marked with [Test]) only the current test will run; if you’re somewhere in the class, but outside of a test method, R# will run all tests from this class.

Just a note to myself…

If you want to use SQL Server Management Objects (SMO) in your .NET applications you should reference assemblies from “C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies”. This is described in almost all articles about how to work with SMO (for example this one).

But if that folder doesn’t exist or required files are missing, they are 2 ways to solve that:

  • Extract required files from GAC
  • Install an additional component for SQL Server: Software Development Kit

Second choice was easier to do for me. So, I just downloaded SQL Server 2005 Express Edition with Advanced Services SP2 and installed the required SDK.

Installation of last Visual Studio on my Vista was enough painful for me to make me post my troubles and solution in hope that may be they will help somebody else…

The nasty problem starts with installation of .NET Framework 3.5, which is a part of and a prerequisite for VS 2008: when installing it, Windows Update will ask you to restart your system. If you will accept rebooting while setup is still running, you will  end up with damaged and unfinished installation of .NET Framework 3.5. So, on Vista you shouldn’t accept restarting computer until installation of .NET Framework 3.5 or Visual Studio 2008 is not finished. The whole problem is described in Aaron Stebner’s weblog: How to avoid OS reboot prompt when installing the .NET Framework 3.5 on Windows Vista. It describes how to avoid it, but not how to make you system back and ready for a next installation, where you will follow recommendations and ignore restart proposal.

Solutions can be very different, it can depend from your concrete situation. After a bunch of tries, ~10 OS restarts, running tools, googling, reading MSDN forums I found my symptoms to be similar to those described here in “Issue 2″ and solution that worked for me:

  1. Install .NET Framework 3.5 beta 2. (I’m not sure if this is really required, but it worked for me)
  2. Uninstall .NET Framework 3.5 beta 2. Restart.
  3. Locate and uninstall any of updates named:
    • Hotfix for Microsoft Windows (KB110806)
    • Hotfix for Microsoft Windows (KB929300)
    • Hotfix for Microsoft Windows (KB930264)
  4. Reboot.

At that moment I was able to run successfully .NET Framework 3.5 installation and after that Visual Studio 2008.

Don’t forget: don’t accept restarting your Vista until installation of .NET Framework 3.5 or Visual Studio 2008 is finished.

And a link mini-dump with places to look for troubleshooting installation problems of Visual Studio 2008 and other related stuff:

Happy coding!

Just finished a big refactoring which led to deletion of a bunch of files. Our large solution is under Subversion, so the process of deleting a file looked like:

  • search with Resharper if class is not used anymore
  • locate it in windows explorer
  • delete file with TortoiseSVN
  • finally, come back to Visual Studio and delete file from solution.

Huh! Not simple, not fast. No surprise, that longest operation was locating file in Windows explorer. But I way lucky enough to remember that I had installed a small but very helpful add-in – CoolCommands 4.0. One of his really cool commands is that from a opened file’s context menu you can “Open containing folder” that not only opens right folder, but also highlights the file. Cool, no?

This is  the case when having right tools around and using them can save you enough time to write a small blog post make you more productive developer.

Unfortunately, CoolCommands doesn’t have a dedicated site and last place where you can find a download link is comments for this post on Gaston’s Milano blog. Direct link to download latest version – CoolCommands 4.0.

And, as a follow up, a list of “cool commands”:

  • Collapse all projects
  • Command prompt here
  • Open project folder
  • Demo font
  • Send by email
  • Copy reference
  • Add as string resource
  • Visual Studio Prompt Here
  • Copy Reference.
  • Locate in solution explorer.

And a picture to help explain how you can find the commands:

CoolCommands's context actions

I like the tools like this. They make you go faster, feel smarter and program better. Enjoy!