Disable single-click file open in Visual Studio 2012 Solution Explorer

One of the first things I do when I install a Visual Studio 2012 is disable the preview tab. This is the single-click file open in the solution explorer.

Each time I have a hard time remembering where the setting is, so this is a reminder for myself:

TOOLS > Options > Environment > Tabs and Windows > Preview Tab > Single-click opens files in the preview tab in: Solution Explorer

Uncheck…

Advertisements

ReSharper: my favorite 5 shortcuts

I admit it, I love ReSharper

Honestly, I’m not affiliated with JetBrains in any way, but I think they’ve got a fantastic tool, which makes a developers life a whole lot easier. If you are a C# developer, you should check it out.

I’m still discovering new functionality, even after using it for a few years. In this post I wanted to share my favorite shortcuts. They’ve saved me countless hours, so hopefully you’ll find some new ones, and save yourself some time too!

A remarks before we begin: these are the default ReSharper mappings, but it’s possible that you’ve made some changes to these mappings. If they don’t work, head over to your Visual Studio settings and check your keyboard mappings

Here they are (in no particular order)

  • Alt-PageUp/Alt-PageDown and Alt-Enter – Next/Previous highlight and Quickfix
    It gives you a great feeling of power and control, just cruising over all the warnings in a file with Alt-PageUp/PageDown and fixing them with Alt-Enter. Clean code in no time.
  • Shift-Alt-L – Locate in Solution Explorer
    When you need to quickly locate the file you have open in the Solution Explorer, this handy shortcut does the trick. You’ll be amazed at how many times you can use this!
  • Ctrl-F12 – Go to Implementation
    Navigating around my code with F12 (Go to Definition) was common practice, but on  an interface most of the time I wanted to go to its implementation. You can imagine my joy when I discovered this shortcut 🙂
  • Ctrl-Shift-R – Refactor this
    The mother of all refactoring shortcuts. This gives you a context menu with the possible refactorings in the current context.
  • Alt-Ins – Generate Code
    Quickly add code like constructors, properties or equality members (super handy on structs).

If you need a quick overview of the keymappings, you can download a PDF for your version from the JetBrains website. Or you can try the keymaps for ReSharper Visual Studio plugin.

Have you got any other favorite shortcuts? A favorite feature in Reshaper? Just love the tool and want to spread the love? Leave a comment!

Biztalk 2009 error: project creation failed in visual studio 2008

I’m had to do some biztalk 2009 development on my machine, but it already had visual studio 2010 installed. So I had to install VS2008, which went better than I hoped (did not have to do an uninstall of 2010).

So I had my biztalk 2009 and my Visual Studio 2008 installed and was ready to go when I came across a problem. When I tried to open an existing or create a new Biztalk project I got this error:

Creating project ‘BizTalk project name’… project creation failed.

Damn…

After some google-fu I found a lot of people experiencing the same problem and even an msdn page about my problem. All of the evidence was correct. I had installed VS2008 SP1   after I installed biztalk.

From the MSDN page:

When Visual Studio 2008 is repaired or when a Visual Studio 2008 update is installed, the value of the following registry entry is changed from csproj;btproj to csproj:

  • For 32-bit versions of Visual Studio 2008:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\PossibleProjectExtensions
  • For 64-bit versions of Visual Studio 2008:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\PossibleProjectExtensions

The problem was that I did not have a PossibleProjectExtensions registry key. I added it, with the correct values. Same error. I repared biztalk. Same error. I restarted multiple times. Same error.

I tried to set the registry key to the value it should have been after an update of Visual Studio (only ‘csproj’) and after doing a repare of Biztalk then I found it changed the value to the correct value. Still, the same error…

So I gave up for now, lost too much time on it already. I’m developing biztalk on a different (virtual machine). Still if anyone has found a solution or experienced the same problem let me know, maybe we could start a self help group…

All unittests with code coverage failing on branch

Because I practice Test Driven Development, I write alot of unittests. When code gets branched, most of the times these unittests all fail (an yes, they all ran green on the main branch). Most of the tests failed with the exception “Could not load file or assembly”.

Time to do some investigating, my dear Watson.

Nothing could be wrong with the tests themselve, because I was sure they worked and since they all failed, it was a global problem. I checked out the test settings we use (x.testsettings, should be next to your sln file) and went through all the tabs.

On the Data and Diagnostics tab I found we only had Code Coverage enabled, so I took a closer look at that by selecting the line and clicking configure at the top of the grid.

Aha, seems like all of these paths are still pointing to my main branch! I have no idea why these paths are not relative, but after selecting the correct assemblies (the ones from my branch) and deselecting the ones from the main brach, all was well and I could return to my unittesting bliss.

Now this is still a bit of a bummer if I have to do this for every branch I make. I should probably try to change these paths to relative ones, but I have not done that yet.

Has anybody else encountered the same problem? How did you solve it?

Slow symbol loading in Visual Studio while debugging

A while ago I was having trouble while debugging in Visual Studio 2010. Each time my debugger had to load symbols to the dll’s I used it went really slow, sometimes even took minutes (or felt like minutes) before I could start debugging. This could not do on my all powerful development machine!

To google!

As with most of life’s problems (or at least most of life’s programming related problems) an answer could be found on stack overflow.
It turned out my experiments with WinDbg where at the root of the problem. In order to get it to load symbols I added some environment variables (‘_NT_SYMBOL_PATH‘ and ‘_NT_ALT_SYMBOL_PATH‘).

Now, Visual Studio has a nice settings screen dedicated to symbol loading, but if you have these environment variables set on your system, it just ignores them. Good stuff…

So after removing both these settings I could debug as fast as lightning again!

I haven’t needed WinDbg since then, so maybe I’ll run into trouble again if i need to use that again. But instead of using WinDbg i’ve used the sos.dll (which I used to debug memory leaks) from inside of Visual Studio, which worked out nicely…