If you’ve been working with Visual Studio 2008, Expression Blend 3 and Silverlight (or WPF) development, you’ve likely used the Open in Expression Blend feature in Visual Studio. This occurs when you right-click on a XAML file in your project/solution and you’ll see that option as long as you have Expression Blend 3 installed.
Well…if you are an eager developer and have installed VS2010 and the Blend Preview for .NET 4, you may have noticed that integration broken.
Problem 1: VS2010 and Blend Preview for .NET 4 on a clean box – NO LINK
You’ve just fired up a new virtual PC or you have a clean install and you’ve installed Visual Studio 2010, the Silverlight 4 tools and Blend Preview for .NET 4. You start your new XAML development project, add some code, then want to use Blend. You right-click and see this:
Nothing. No option. You miss that convenience of immediately opening the solution/file from VS to Blend and want it back. You are confused because you have both installed!
Problem 2: VS2010 shows me the link, but it opens in Expression Blend 3
The other problem you may face is that you have VS2010, Blend 3 and Blend Preview for .NET 4 installed. You see the Open in Expression Blend option, but when you click on it expecting it to open the latest Blend, it opens your VS2010 project in Blend 3 (or tries to) and fails. You want to change this to open in Blend Preview for .NET 4.
I have a solution for you and luckily it is a fairly easy one.
First, a warning that “here be dragons” – this is a registry editing procedure. If you aren’t familiar with editing your registry, or don’t know what it is (highly unlikely), then you shouldn’t be doing this. Screwing up your registry can cause irreparable damage and may harm small kittens in the process. Seriously, you’ve been warned so don’t email me if your machine explodes into a pile of dust. Hey, it works on my machine.
With the warning aside, here’s the fix. Basically Visual Studio looks for a specific key in the HKLM (that’s HKEY_LOCAL_MACHINE to you registry noobs) for where to launch Expression Blend. There is only one setting though, so this will apply for any VS instance you have installed. Once you implement the registry setting you’ll see the option:
It is located in HKLM\Software\Microsoft\Expression\Blend – there is a key that VS is looking for there named “VS” with one String value named “BlendLaunchPath” which has the full path to the version of Expression Blend you want to launch.
2: "BlendLaunchPath"="\"c:\\Program Files\\Microsoft Expression\\Blend Preview for .NET 4\\Blend.exe\""
So if you are missing the link or want to change the link that exists (because you are running Blend 3 and Blend Preview for .NET 4 side-by-side – which can be done if you didn’t know that) all you have to do is change that path.
I’m providing a ZIP file of the registry file you can merge (a .REG file) for both 32-bit or 64-bit (x64 is in the Wow6432Node) that will automatically add this setting for you assuming you have Blend Preview for .NET 4 installed in the default location. You can get that ZIP file here: OpenInBlendRegHack.zip.
Hopefully this is a helpful little tip for you if you want to implement this integration between the beta of VS and the preview of Blend. I use this integration a lot and it’s nice to have it working with the new tools and not miss anything. REMINDER: Changing this registry change makes it changed for both VS2010 and VS2008...be warned. Hope this helps!