The World’s Leading Microsoft .NET Magazine
   
 
The .NET Addict's Blog

My Top Tags

                                                           

My RSS Feeds








I heart FeedBurner

Latest Diggs - Programming

Computers Blogs - Blog Top Sites

Site Hits

Total: 4,907,656
since: 19 Jan 2005

Extending your Applications with MAF/VSTA Addins - Part IV

posted Fri 28 Jul 06
I left off at the point where I needed to register my AddIn application as a host, and then I was going to move on from there. I originally planned on giving you yet another detailed explanation of everything I did... but unfortunately I think I am going to summarize a bit here. You'll find out why when I get to the end of the story.

The next step after creating the new application is to create proxies from the source application. To do this, I issued the following command as given to me by the SDK walkthrough:
proxygen /l:"(full path to my .EXE file)" /c:AddInHostProxy.cs /o:AddInHostOM.xml

This seemed to work.. gave me a couple warnings but then the SDK mentions that it would do this. Then, following more of the SDK instructions, I go into the AddInHostOM.xml file and add isExcluded=true to the end of the <Class/> element for my HostedApplicationRoot class.
Next I continue following the SDK and re-run the proxygen command line. This time I change /o: to /i: , supposedly using the modified Object Model Descriptor file (AddInHostOM.xml) to further refine the proxy to include what needs to be included and exclude what should be excluded. Couple more warnings, but it gives me a new AddInHostProxy.cs file, so I figure all is well.

Next, I create a new class library called AddInHostLib. Into this class library I add the proxy generated in the previous steps and add all of the references to the DLLs that the SDK indicates I need to add (System.AddIn.Contract, System.Windows.Forms, Microsoft.VisualStudio.Tools.Applications.Adapter, Microsoft.VisualStudio.Tools.Contract). I attempt to compile. no dice. Errors all over the place, complaining about members that don't exist, abstract inherited members that have not been implemented -- you name it, I had a compile-time error for it. So I go back into the AddInHostOM.xml file and start doing some more tweaking. Long story short, 2 hours later I had a completely ravaged XML file that had been stripped of virtually all its content, and I re-ran the proxygen command line tool... and it eventually compiled. Two Hours Later.

Next, I gave the Assembly a strong name with a password protected key file and I'm off to the races. I followed the walk-through for creating Visual Studio project templates using the projectgen.exe tool. I had to re-do this step about 4 or 5 times ,following the SDK's directions to the letter. Finally, after manually copying some files to where I thought they should've gone in the first place, the project templates show up in my list of general C# project types.

So, I create a new project of type "AddInHostDemo Add-In" and I add a line to give me a simple MessageBox when the addIn starts up:

using System;
using System.Windows.Forms;

namespace AddInHostDemoAddIn1
{

    public partial class HostApplication
    {
         private void HostApplication_Startup(object sender, EventArgs e)
         {
             MessageBox.Show("My custom plug-in started up... the application must have found me!");
         } 

        private void HostApplication_Shutdown(object sender, EventArgs e)
        { }
 
 // VSTA-generated code snipped out

    }
}


So that's the bulk of my add-in. I actually found the process of writing the add-in itself FAR more appealing than in enabling the host application for add-in support (that's how it should be...but the gap is bigger than it could be, in my opinion. After I built this plug-in, I copied it to the directory that the LoadAddIns() method in the host application would be looking for and fired it off. Sure enough, I saw the message box.

My overall opinion of the current state of building applications that support AddIns via the VSTA technology is that I'd probably rate it a 3 out of 5. The technology behind it is quite good, and it provides some very powerful and flexible extensibility options for applications where extensibility is a large concern. That said, if all you want to do is fire off a single method from a remote DLL, this architecture is not for you. If, on the other hand, you want to give plugins the ability to manipulate an exposed object model in order to be able to inject behavior into predictable locations throughout your application - VSTA is definitely the way to go.

I am dissapointed with the complexity of the process, because I know it can be FAR less complex. I am dissappointed with the fact that the developers, and probably the SDK sample developers, still have a "COM" mindset about API development. The whole thing feels very COM-like, and that turns me off. It is very hard to get past the COM-like nature of the system and move into the actual code. I think that at this point, this system is not ready for prime time. First, following the SDK walkthrough leads you into a pit of endless despair unless you know enough to infer what they really meant when they gave instructions. Secondly, the complexity is a barrier for many people. I would probably have to go through this entire process to to three full times again in order to feel comfortable enough with VSTA add-ins to recommend them or not recommend them as a viable solution for current problems.

Feel free to make up your own mind. For me, I'm waiting for another CTP and I will try the entire process again to see if its any smoother. If it isn't, I might just write my own plug-in system. Anyone with the technical ability to create applications that are VSTA Add-in aware is also smart enough to build their own less complicated plug-in system in roughly the same time it takes to complete the walkthrough. That fact is what bugs me about this setup. Until that fact changes, I think they have a lot of work to do.

tags:              

links: digg this    del.icio.us    technorati    reddit

AddThis Social Bookmark Button




1. Gary left...
Wed 30 Aug 06 4:10 pm

Roll your own scripting vs VSTA integration:

In VSTA, version 1, application customization is focused on Add-in assemblies because Microsoft required security, process isolation and versioning to be a fundamental part of application extensibility going forward. Their foresight in this matter is a great advantage to the ISV as they release their application and grow a scripting community around it, though it adds some complexity to the initial integration process.

In response to 3 of your stated concerns:

1)I think that at this point, this system is not ready for prime time.

VSTA is already running in MS InfoPath 2007 and spec’d for MS SQL Server Integration Services, so it’s clearly ready for prime time.

In V1, there are limited features, but the great thing about VSTA is that all of the innovations are on top of .NET framework and VSTA will continually inherit innovations from .NET and Visual Studio

VSTA Design time and run time bits are all based on the .Net framework allowing you to use productivity features like code help, intellisense, etc. in your integration process.

The VSTA IDE is lighter weight build of Visual Studio (same bits) with productivity features like code help, intellisense, etc. that you can pass on to users.

Valuable VSTA macros, recorded or written in an organization, can be opened in Visual Studio Professional, so that any developer on the IT staff can modify and maintain them.

2) Secondly, the complexity is a barrier for many people.

Summit's VSTA integration support is ready for prime time as well. If you had contacted us during your eval we would have made the complex more simple for you. We will do this for any ISV interested in integrating VSTA.

Summit regularly adds new documents and samples that more fully explore the details of integrating VSTA. We post these samples on our site

3) Anyone with the technical ability to create applications that are VSTA Add-in aware is also smart enough to build their own less complicated plug-in system in roughly the same time it takes to complete the walkthrough.

Building your own plug-in system is more complex than you may think when you consider security, process isolation and versioning in your design (which you should). When you design-in VSTA, you will enjoy the architectural contributions (like MAF of thousands of developers in the extensibility community, Microsoft’s regular improvements to VSTA, and Summit Software’s guidance through the entire integration process.


2. Kevin Hoffman left...

I did contact you folks - nobody replied.


3. Leandro Caffé left...
Tue 28 Nov 06 5:47 pm

Hi, Kevin! Thank you for the articles, but... where is the fixed XML? Why didn't you post it here?

Gary, I don't think so... There is nothing really useful about VSTA in your site. Is the VSTA a big lie???

Visitant, if you are interest in to read this article, don't waste your time... Your are going to stop at the same point that the SDK documentation stoped.


Tag Related Posts

WPF Bumper Stickers

Tue 12 Dec 06 7:32 P GMT-05

First Impressions of Windows Vista RC1

Thu 07 Sep 06 1:30 P GMT-05
tags:                      

Localizing a WPF Application

Tue 22 Aug 06 11:39 A GMT-05
tags:            

WPF Slide Show and Photo Album

Fri 18 Aug 06 6:48 P GMT-05

Is Windows Workflow Foundation Too Complex?

Fri 18 Aug 06 12:15 P GMT-05

ADO.NET Entity Framework Announced Today!

Wed 16 Aug 06 11:08 A GMT-05

Extending your Applications with MAF/VSTA - Part III

Fri 21 Jul 06 12:30 A GMT-05
tags:            

Extending your Application with MAF/VSTA AddIns

Thu 20 Jul 06 1:51 A GMT-05
tags:            

July CTP is out... yay.

Tue 18 Jul 06 6:34 P GMT-05
tags:    

.NET Framework 3.0 June CTP is out!

Fri 23 Jun 06 6:23 P GMT-05
tags:                

Lambda Lambda Lambda

Sun 21 May 06 1:01 A GMT-05