Visual Studio 2010 Extensibility

If you open Visual Studio 2010 the first thing you probably will notice is that the Start Page has been completely redesigned. The Start Page is now created with WPF, yes you have read it correctly, and it is not the only thing that uses WPF, the code editor is also WPF based.

Original start page

As you can imagine the page can be customized (which by the way was already possible in Visual Studio 2003), to do it you only need to modify the template found in the directory "%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\StartPages\<culture>", place your modified version in the folder "%UserProfile%\Documents\Visual Studio 10\StartPages" and that's all, your customized StartPage will be loaded immediately without needing restart Visual Studio.

Mad about NET Section

The screenshot above shows an easy customization that I've done. I've just added a new TrayItem on the left side and took profit of the dll Microsoft.VisualStudio.Shell.UI to run some Visual Studio commands to open an IE window, view Visual Studio as full screen and open the Team Explorer window. Below you can see the necessary XAML to do it.

   1:  <!-- Customized tray-->
   2:  <!-- Mad About .NET group -->
   3:  <vs:TrayItem Header="Mad about .NET" x:Uid="Custom_Header">
   4:      <vs:TrayGroup>
   5:          <vs:TrayGroupItem Content="Mad about .NET Blog"
   6:              ImageSource="pack://application:,,,/Microsoft.VisualStudio.Shell.UI;
   7:                            Component/Packages/StartPage/Images/12_settings.png"
   8:              Command="{x:Static vs:VSCommands.Browse}"
   9:              CommandParameter="{StaticResource Links.MadAboutNET}"
  10:              x:Uid="MadaboutNET_Item"
  11:          />
  12:          <vs:TrayGroupItem Content="Go Full Screen"
  13:              ImageSource="pack://application:,,,/Microsoft.VisualStudio.Shell.UI;
  14:                            Component/Packages/StartPage/Images/12_settings.png"
  15:              Command="{x:Static vs:VSCommands.ExecuteCommand}"
  16:              CommandParameter="View.FullScreen"
  17:              x:Uid="TeamExplorer_Item"
  18:          />
  19:          <vs:TrayGroupItem Content="Open Team Explorer"
  20:              ImageSource="pack://application:,,,/Microsoft.VisualStudio.Shell.UI;
  21:                            Component/Packages/StartPage/Images/12_settings.png"
  22:              Command="{x:Static vs:VSCommands.ExecuteCommand}"
  23:              CommandParameter="View.TeamExplorer"
  24:              x:Uid="TeamExplorer_Item"
  25:          />
  26:      </vs:TrayGroup>
  27:  </vs:TrayItem>

Regardless the utility or futility of customizing the StartPage, we need to look further. We must look the new extensibility options that Visual Studio 2010 will bring, incorporating WPF opens a new world of options to extend our favorite development tool. But this is just a small piece of the cake, if you want to know more you should check the Managed Extensibility Framework and don't forget to visit the blog of the VSX Team.

Visual Studio 2008/2005 DateTime2 problem

Some days ago I was doing some tests with Visual Studio 2008 Beta 2 and I saw the DbType enumeration contains two new members, DateTime2 and DateTimeOffset, until here nothing strange.

The problem came up today when I was working with Visual Studio 2005, I was using again the enumeration and I saw the Intellisense also shows these new members, which are not included with the Framework 2.0.

This is very weird but the first thing I thought was that it could be a problem with the Intellisense being corrupted after install Beta 2. So, I wrote some code making use of them. The code is very simple, I display in a console application the string and the int representation of "DateTime2". Then I convert the string and int representation of "DateTime2" to the equivalent enumerated object.

This works perfectly without any error from Framework 2.0. The compiler and the references used from VS2005 are got from the path "Framework\v2.0.50727\", so all seems to run as expected,  but this is very confusing because these are new values added in the Framework 3.5 and work from Framework 2.0

In fact, if you try to build the same application from a computer without the Visual Studio 2008 beta 2 installed, you cannot compile it. The thing is that you can even run it and all works smoothly, except when you try to parse into a variable of DbType the string representation, this will throw an exception because of course "DateTime2" is not a valid name value of the DbType Enumeration.

If we look more in deep what can cause this, we will see that the files csc.exe and the System.Data.dll have different file versions on computers with VS 2008 Beta 2 installed. You can even use reflector and decompile the System.Data.dll to see that the enumeration contains the new values.

This is very upsetting because introducing this simple code can make your application crashes during runtime, note that we were using Visual Studio 2005 to build and run the code and all works fine until you move it to another computer without VS2008 installed.

This is clearly not side-by-side execution and I hope it is just a bug that will be fixed or something I overlooked, otherwise I can see lot of bad times when half of the park works with Visual Studio 2008 multi targeting and the other half with Visual Studio 2005.