Have you recently done a fresh installation of Office 2010 with InfoPath 2010 and tried to work on an InfoPath Form Template or InfoPath Add-in project? If you are getting one of these errors:

 

One or more projects in the solution could not be loaded for the following reason(s):

The application for the project is not installed.

These projects will be labeled as unavailable in Solution Explorer. Expand the project node to show the reason the project could not be loaded.

-or-

Error: this template attempted to load an untrusted component ‘Microsoft.Office.InfoPath.Vsta, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL’.  For more information on this problem and how to enable this template, please see documentation on Customizing Project Templates.

-or-

Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))

How did I get myself into this mess? I had to re-install Windows 7 on my development box. So, I figured I would install Office 2010 rather than 2007. I then installed Visual Studio 2008 with the Office tools (we have lots of customers that still require our solutions be delivered in 2008 rather than 2010 format). I tried opening an InfoPath Forms project that I had previously been able to open and compile, and got the first error. I tried creating a new InfoPath Forms project and got the second error.

The short of it is that an Office 2010 installation does not contain the necessary DLLs, COM Object registrations, and assemblies that Visual Studio 2008 needs in order to do create the Office 2007 projects surfaced by the Office Tools for Visual Studio components packaged with Visual Studio. You need to have the Office 2007 applications installed before you install Visual Studio 2008.

Here are the steps I used to fix the errors. Notice that I already had Office 2010 and Visual Studio installed before I started on the steps to fix the errors in this post:

  1. Install InfoPath 2007, including the shared features
  2. Install Office 2007 Service Pack 2
  3. Uninstall Visual Studio 2005 Tools for Office Second Edition (VSTA)
  4. Uninstall Visual Studio Tools for Office Runtime 3.0 (VSTO)
  5. Install VSTO
    <Visual Studio Install Disc>:WCUVS Tools for Officevstor30.exe
  6. Install VSTA
    <Visual Studio Install Disc>:WCUVS Tools for Officevstor.exe
  7. Full repair of Visual Studio 2008

After I completed steps 1 and 2, I no longer received the first two errors about missing assemblies. Now I received the error about the missing COM library registration. I did not get rid of all errors until I completed step 7. I should note that I don’t know if steps 3-6 were necessary since I ultimately did a complete repair of Visual Studio in step 7. I list those steps for the sake of completeness.

You may be wondering why I just didn’t upgrade to Visual Studio 2010 and potentially save myself some headaches here. Well there are a few reasons. First, most of customers still require our solutions be delivered in 2008 rather than 2010 format, so even if I were to install Visual Studio 2010, I would still need to work with Visual Studio 2008 for the majority of our customer projects. But more importantly, it appears that Visual Studio 2010 does not support integrated InfoPath development with any version of InfoPath, 2007 or 2010. So for now, it looks like I will be using Visual Studio 2008 with InfoPath 2007 for my InfoPath forms development.