Crash Course in VSTO

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:

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…

Moved to Hosting

Moved this site to hosting this weekend from Brinkster. My rate with Brinkster was going up (I originally signed up during a 50% off sale) and they’ve annoyed me a few times when they would change things (breaking my site) with no notice. I’ve seen plenty of complaints about GoDaddy hosting around The Web, but I figured I’d try it myself for a couple months. And they’re CHEAP!

One of the first problems I had was getting this blog up and running. GoDaddy no longer officially supports PHP on their Windows hosting, but it is installed. I need PHP (for now) because this is a WordPress blog. I plan to eventually move to a .NET based blog, but I wanted to get moved over to GoDaddy fairly quickly.

The problem I had was getting connected to the MySQL database. GoDaddy provides either MySQL 4.1 or 5.0. The version of PHP installed on their Windows hosts is an older version and therefore, an older version of the MySQL client and it won’t connect to MySQL 4.1+ by default. After much Googling, I learned that the password hash in 4.1 and above has changed to a larger size that the older clients do not support. MySQL, however can still generate the older hashes for backward compatibility. The work around is to change your MySQL password using the following command:

set password = old_password(“yournewpassword”)

The “old_password” function generates the old-style password hash. This is less secure, but at least I’m up and running. As I said, I plan to move off WordPress anyway, so this is only temporary. You’d think GoDaddy would document this somewhere, but they appear to pretend that PHP on Windows hosting does not exist (and maybe it won’t someday – they tell you to use their Linux hosting if you want PHP). Hopefully, this helps someone else troubleshoot this problem someday…