Friday, July 16, 2010

How to install the Blend 4 Item Templates into VS 2010

Recently I was trying to create a Behavior in VS 2010. I thought I already had everything needed for this. This is what I had installed on my machine:

- Microsoft Silverlight 4 (ver 4.0.50524.0)

- Microsoft Silverlight 4 SDK (ver 4.0.50401.0)

- Microsoft Silverlight 4 Toolkit April 2010 (ver 4.0.40413.2020)

- Microsoft Silverlight 4 Tools for Visual Studio 2010 (ver 10.0.30319.156)

- Microsoft Expression Blend 4 (version 4.0.20421.0)

- Microsoft Expression Blend SDK for .NET 4 (version 2.0.20525.0)

- Microsoft Expression Blend SDK for Silverlight 4 (version 2.0.20525.0)

But, when I tried to create a “New Item” in my Silverlight project in VS 2010, I couldn’t find any installed templates for this.

But I knew, that I had been doing this in Blend and VS 2008 recently. So I jumped onto the band-wagon to look back for the installedtemplates option in the “devenv” command for Visual Studio.

So, this is what I did:

#1. Locate the “Expression Blend” folder in this location: “C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp” (your loc may be different based upon your installation). There is a sub-folder “1033”, which contains Action.zip, Behavior.zip and Trigger.zip.

#2. Copy-Paste this folder to this location “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp” (again your loc may be different based upon your installation.)

#3. Close all the VS running environments.

#4. Start the VS command prompt from the VS Tools menu.

#5. Run the command [devenv /installtemplates]

#6 Start VS 2010, open any new/existing project, try creating/adding a new item now. You will find a new folder under “Visual C#” namely, “Expression Blend”. (Under C# because we copied from the CSharp location in step #1 above.) This will list the three installed items.

Now go ahead and start creating those Actions, Behaviors and Triggers.