Welcome to MSDN Blogs Sign in | Join | Help

Managed Add-In Improvements

Today we have the second of two guest posts from Patrick Smith, a program manager on the Office Programmability team.

Overview and Background

Managed code is becoming more and more prevalent in add-ins written for Microsoft Office products.  Also shipping around the same time frame as the 2007 Microsoft Office System is the next version of Visual Studio Tools for Office (VSTO).   The next version of VSTO has added support for creating application level add-ins.  The demand for better support of managed add-ins is clear since with Office 2003, there are a few challenges when running managed code.  Among these challenges are security, resiliency, administration, and isolation.  Most of these challenges are the result of add-ins based on mscoree.dll which is the loader used by the default VS.NET add-in template.

While there are workarounds to these barriers such as creating a separate unmanaged “shim” to use in place of mscoree.dll, we wanted to make this process better for the products in the 2007 Microsoft Office System.  We’ve done exactly that!  

The Improvements

As a developer, you can now design your add-in to use a new AddinLoader supplied in a new version of  VSTO.   This new AddinLoader helps overcome these historical challenges when running managed code in Office:

  • The security model – Microsoft Office System 2003 products bases all add-in security decisions based on mscoree.dll which cannot be signed.  Because of this security model, the add-in itself can be signed but the Office product would not know it because it is only looking at mscoree.dll. and since it’s only looking at mscoree.dll, no add-in can run when the Office application is set to High security.   Now, if an add-in is based on the AddinLoader, the 2007 Microsoft Office System will be able to defer to the .NET security model to make the security decisions for the add-in.  This is only possible by using AddinLoader.
  • The resiliency model – Microsoft Office System 2003 products will automatically disable add-ins that fail to load so that future problems with the add-in can be prevented, however, since the add-in is actually seen as mscoree.dll, mscoree.dll is the add-in that is disabled rather than the actual managed COM add-in that is causing a problem.  This prevents any other mscoree.dll based add-ins from loading as well because the loader itself is disabled.  Now the add-in is seen rather than the loader and ill-behaving add-ins can be disabled individually rather than the loader.
  • Administration – When viewing the Add-Ins dialog box, mscoree.dll is seen as the add-in name rather than the actual managed COM add-in that is running within mscoree.dll.  Once you are running more than one add-in, it becomes difficult to discern which one is which.  Now the name of the actual add-in is displayed.
  • Runtime Isolation – mscoree.dll loads all add-ins into the default AppDomain.  Therefore, with no memory isolation, add-ins can step on each other and affect objects that are shared between add-ins.  The new AddinLoader will use separate AppDomains for the add-in and therefore provide isolation to that add-in.

What’s needed

In order to take advantage of these new improvements, you will need to create your add-in using the new version of VSTO.  (There is a technology preview of this version located here.

In addition, you’ll need to ensure the following configuration is available on the machine where the add-in is to be loaded:

  • Common Language Runtime 2.0 or greater
  • VSTO Runtime (from the new version of VSTO)
  • CAS policy giving the Add-in full trust

All of these prerequisites can be configured through the setup project for the add-in you create in VSTO.

Published Wednesday, June 21, 2006 8:06 AM by David Gainer
Filed under:

Comments

# re: Managed Add-In Improvements

Wednesday, June 21, 2006 1:04 PM by XL-Dennis
Patrick,

Thanks for Your good post on the subject!

I believe we all understand that it takes time to develop a new tool like VSTO. It's also a complex process and therefore not all pieces are immediately in place. The upcoming 3.0 of VSTO seems to solve several issues we now are facing with 2.0. A general experience is that new versions solve today’s issues but also create new issues.

As a developer I work in three time zones, the present, the past and the future. Whenever I read anything from MSFT nowadays I can only see that You talk about the future and how nice the upcoming tools are.

Me, as well as other developers, cannot postpone everything to the future as we will then be out of business within a nano second or so. Sure, many good people in the online community have spent considerable time to find workarounds which have been published in one or another way. However, the rapid development and the attitude to only look ahead put all us developers in a difficult situation as we need to take responsibility for the present and the past.

As it is now I can only play around with all the new tools on a test computer and meantime ship solutions to my clients based on ‘old and outdated technologies’ like classic VB and C/C++.

Kind regards,
Dennis

# re: Managed Add-In Improvements

Thursday, June 22, 2006 3:27 AM by DM Unseen
To make Dennis his comment clear:

Is the coming VSTO at least compatible with/going to be made compatible with Excel 2003 (I prefer also compatability with Excel 2002).

# Roadmap for 3rd party code in Excel

Thursday, June 22, 2006 6:53 AM by John Greenan
Hi,

Generally I am supportive of the work that David Gainer does on this blog - I read every post and I think it's excellent.

So, that's the nice part of this post done.  I must say that I just cannot see that anyone in Microsoft has spent much time BEFORE release of the .net runtime to see where this would lead.  Even now, as a firm we still ship all of out excel based code as VB6 COM, RTD or automation addins. It's just too hard to deploy this version of the .net run time with that set up and blah blah onto an investment bank trading floor.  

While it's not hard to work around all of the limitations that exist at the moment, this uncertainty "shipping around the same time frame as the 2007 Microsoft Office System" means that adoption of this is delayed.  

Without wanting to go on (and on) what is the actual Microsoft roadmap for 3rd party developers?  Does Microsoft even have one?  There are lots of firms and individuals who drive Excel adoption and retention by developing addins and tools that use Excel and many of the people that I talk to are concerned that there does not seem to be a vision for where the product is going.  Compare this http://www.joelonsoftware.com/items/2006/06/16.html with the current state of Microsoft excel add-in development.  Could you see Billg signing off on what is going on now?

Why not come clean and say what the roadmap is?

I'm not some anti-Microsoft linux geek, I work for a firm that exists by selling products and consultancy based around Microsoft products like SQL Server, VB6 and vb.net, C# and Excel.  But I want to know where this is going - what's the roadmap and if I should continue to back Microsoft technology or investigate using gnumeric, google spreadsheets or suchlike.  Yes, I work for a small firm, so it's not going to be a dip in earnings for Microsoft if we stop writing against your products but there are other people and firms that have these concerns.

In summary, what's the roadmap for third party add-in code to Excel???

# Office Programmability Tips

Thursday, June 22, 2006 7:11 AM by Doug Mahugh
Here's a nice summary of the benefits of developing Office add-ins with the new VSTO AddinLoader. Security...

# re: Managed Add-In Improvements

Thursday, June 22, 2006 4:30 PM by Simon Murphy
I agree with John, it would be nice to see the big picture.
This does look like an improvement over the previous versions, although I do think the .net story drops through the crack between office developers and visual studio developers.  The office devs rarely have control of the server or client for installing frameworks and VS devs are more interested in the web than office.
Personally, I still see a long future for C xlls (unless the recent trend for breaking backwards compatibility continues)
cheers
Simon

# re: Managed Add-In Improvements

Thursday, June 22, 2006 7:36 PM by D'uh
(unless the recent trend for breaking backwards compatibility continues)

# re: Managed Add-In Improvements

Thursday, June 22, 2006 11:45 PM by Mike Staunton
I'm with John on this

It used to be that the VS users had their road-map whilst Office users had nothing and hence assumed that the status quo would continue - now we have a handful of Office blogs that are lively and informed with daily posts whereas the VSTO and VSTA or whatever blogs are moribund and months old

All the code I write is in VBA user-defined functions and, whilst I'm trying to make my code portable (avoiding Excel functions, always using Base 0) to say one of the .NET languages as well, there seems little incentive to move at present - the need to include the .NET framework and some of the speed penalties are the two key points for me

Until then there'll be lots of us continuing to use legacy products and if I'm not persuaded by three attempts with VSTO it's unlikely to happen anytime soon
New Comments to this post are disabled
 
Page view tracker