Archive for category Tools

Quick tips & tricks. ReSharper’s goodness.

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.

2 Comments

Reference SMO assemblies from Visual Studio

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.

Leave a Comment

Be careful when installing Visual Studio 2008 RTM on your Vista.

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!

1 Comment

Be smart – use right tools, save your time…

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!

4 Comments

Follow

Get every new post delivered to your Inbox.