Scott Hanselman

Demo Dashboard and IDE Extensions - Whirlwind Tour around .NET 4 (and Visual Studio 2010) Beta 1

May 21, 2009 Comment on this post [8] Posted in Open Source | Source Code | TechEd | Tools
Sponsored By

It's getting considerably easier to create and distribute Visual Studio Extensions.  With Visual Studio 2008, you can find extensions at the Visual Studio Gallery. There's also a very good VSX (Visual Studio Extensibility) Developer Center on MSDN that has a ridiculous amount of information on how to extend VS, and there are LOTS of great VS 2008 add-ins. The documentation is really well fleshed-out. It also includes info on the little-known, but totally awesome "VS Shell," but that's another post.

Visual Studio 2010 Beta 1 shows some new and interesting was to extend VS. One nice way to say it is "moving beyond add-ins." One example is that the Editor in VS2010 uses MEF (Managed Extensibility Framework) at its heart. It also uses Immutable Text Snapshots that make accessing the buffer from other threads easier. I talked to Noah Richards, one of the devs on the editor, in a recent episode of my podcast.

Terry Clancy points out how much easier it is. Seriously, the post is of epic length, check it out.

For the Visual Studio 2010 Shell, we’ve made targeted investments to the developer experience:

· No more complicated load keys! - Developers are no longer required to procure a Package Load Key (PLK) or a Shell Load Key (SLK) to develop Visual Studio 2010 Shell applications!

· No requirement for Registry. Packages can now be installed without requiring developers to update configuration settings in the Windows registry.  In many cases, this means that packages can now be x-copy deployed.

· Easier, more robust deployment – The redistributable shell installers have been updated to support Windows Installer source caching features, thus is during a repair, user’s won’t be required to point MSI to the original installation file or media.

· Improved SDK tooling – New templates have been added to make it easier to get started with the Visual Studio Shell, and create common types of extensions.  For Visual Studio Shell (Isolated Mode) developers, we’ve significantly improved performance of our F5 Debugging experience.

So what does a VS2010 extension look like?

Installing a VS2010 Extension with the Online Gallery and Extension Manager

Doing my talk on .NET 4 at TechEd this year, I got to use a new extension from the folks at Clarius Consulting called the Demo Dashboard. The idea is that while you're giving a talk at a conference like TechEd, the audience is using Twitter and a hash-tag that you set (I used #scottha) to give you real time feedback on your presentation. They can tell you if you're doing a good job, if your fonts are the right size, your speed, and they'll also give you a headcount of twitter users in your talk.

The code for the Demo Dashboard is up at Codeplex under Ms-PL while the extension itself is at the VS Gallery. It's actually a VS extension WITH extensions of it's own!

demo_dashboard

The plugin integrates with the Editor and hangs around (it can be collapsed) while you're giving your talk. For my talk, I used a debug build and just dropped it into the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Components folder.

However, you can just go to the Extensions Manager and download it directly into Visual Studio:

Extension Manager (2)

If you download it manually from a website like the Visuals Studio Gallery, you'll notice the VSIX extension is associated with Visual Studio:

File Download (2)

You'll be warned that 'VSLauncher' is trying to run something, and if you accept it, the VSIXInstaller will do its thing. It's easier to just do it from inside the Extension Manager in Visual Studio.

The Demo Dashboard is entirely written in managed code and is actually a WPF app. Notice in this screenshot of the main XAML file that the plugin is actually running inside the WPF editor at the bottom of the split-screen view.

VsSpeakerCompanion - Microsoft Visual Studio (Administrator) (2)

They Demo Dashboard folks created a whole sub-plugin model you can use to extend this dashboard for your own conference. Using MEF (now built into .NET 4), they're pulling in a Twitter Service, and having Widget DLLs provide one or more widgets.

namespace CoolnessWidget
{
[Export(typeof(IWidgetProvider))]
[Widget(Name = "Cool Widget", After = "Font Size Widget")]
internal class CoolWidgetProvider : IWidgetProvider
{
IEnumerable<IWidget> IWidgetProvider.GetWidgets(Context context)
{
// creates an instance of our widget providing it the core context and twitter service to work with
CoolWidget widget = new CoolWidget(context, this.TwitterService);
return new List<IWidget> { widget };
}

[Import]
private TwitterService TwitterService { get; set; }
}
}

There's a lot of great examples in the code on clever ways to use MEF to make consumption of services easier by plugins. The WidgetManager class brings together a bunch or "hard to deal with" classes, then Exports them via MEF to make consumption easier by other classes and plugins downstream.

I think, however that it could be even MEFier. Remember, it's Ms-PL, and a CodePlex project, and there's a lot of TODO:'s marked in the comments, do we're free to change and improve the code. Go check it out.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
May 21, 2009 23:35
Slow down Scott! This is really a Whirlwind tour.
May 22, 2009 1:18

Scott, are you actually using Beta1 with the default fuzzy WPF text rendering? (fuzzy menus and tooltips)

Or do you have a secret ninja 'no-headaches' code which enables the WPF4.0 text renderer? (Which we had been lead to believe was going to fix this problem.)
May 22, 2009 2:25
lol @ Will, the fonts do look a lot better on his screenshots hey :) ? Maybe he is running a super secret build, but I doubt it =) I also harassed Jason Zander about this issue on his blog wondering if he has more information on if we can expect the font blurriness issue to be fixed by RTM VS 2010 but my comment hasn't been approved yet http://blogs.msdn.com/jasonz/archive/2009/05/18/announcing-vs2010-net-framework-4-0-beta-1.aspx.

I really can't believe how many people don't see this is as a huge issue, some people are like, 'if you have cleartype on there shouldn't be any issues?' Argh. Slap.
May 22, 2009 2:41
@graham - there's a video posted on Channel 9 in the last couple of days which says that the new WPF4 font rendering missed B1 and is going to be in B2, whenever that is.

Of course, if it's still cruddy then, there'll be the usual "can't be changed in time for RTM", but I do have some hope it's being fixed.
May 22, 2009 3:06
The new Font stuff will be in Beta 2 and the fonts will be as clear as they are in VS2008.
May 22, 2009 3:15
When's B2 then Scott ;-)
May 22, 2009 4:44
I don't mean to oppose the anti-WPF-fonts position, but being part of the team that developed the demo dashboard (meaning, having spent a good few weeks on dev10) I can assure you that I didn't notice. And the intellisense and the TDD features in Dev10 are truly amazing, I'm having trouble going back to Visual Studio 2008.
joj
February 07, 2010 2:10
nice!
didn't know it was that easy... going to create one myself soon... (just need to figure out what would be useful)

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.