I’ve inherited yet another project at work. This latest one includes a series of reports all done in Excel with VBA macros. The code for these macros is almost unmaintainable, so I’m trying get these rewritten using Visual Studio Tools for Office (VSTO). This is my first experience with VSTO and right now I’m in the “proof of concept” stage, struggling with deploying a test case using ClickOnce.
So far, here’s what I’ve learned:
- Visual Studio 2008 ships with VSTO “in the box”
- There are several options, depending on if you want to target Office 2003, 2007, .NET 2.0, 3.0, 3.5
- You can’t target 2007 specifically and use anything but .NET 3.5
- Only .NET 3.5 supports deploying VSTO solutions using ClickOnce
As I write this, I’m testing using IIS 7 running under Vista (yes, I’m a glutton for punishment) for my publishing location and have Windows XP running under Virtual PC with Office 2003 for testing the deployment. So far I’ve had several attempts at getting the bootstrap to download and install .NET 3.5 and the VSTO runtime. To work around a couple of the problems I had to manually add application/octet-stream MIME types to IIS for the .MSP and .MSU files that are part of the .NET Framework redistributable.
Everything is downloading now, but the install failed with a “Status of package ‘.NET Framework 3.5’ after install is ‘InstallFailed'” in the installer log file. I’ll update this post once I get that figured out…
UPDATE: Rebooted the VPC and now the .NET Framework installed. Gotta love it.
UPDATE: Needed another MIME type set up for .vsto files: http://msdn2.microsoft.com/en-us/library/bb608629(VS.90).aspx
UPDATE: And after all of that, it doesn’t work with Excel 2003. I get the error: The common language runtime could not be loaded by Excel file path. Contact your administrator for further assistance. I thought maybe if I used the Office 2007 VSTO project template, but saved the Workbook using the 97-2003 compatible format I could open it in Excel 2007 or 2003. No such luck. Looks like if you want to use VSTO + ClickOnce, you have to target Office 2007 users…