Upgrading VSTO project to Visual Studio 2010

In some cases I ( and my customers ) have run into build errors after upgrading VSTO based solutions ( for Visio or other Office applications ) from Visual Studio 2008 to Visual Studio 2010.  For example:

image

The build errors noted above seem to indicate that our ThisAddin class is no longer part of the project, or no longer defined in the namespace…and that is indeed the case.  The upgrade process regenerated the Thisaddin.Designer.cs file and used the namespace declared in the ThisAddin.Designer.xml file as the default namespace.

image

The fix is to manually edit the namespace in the ThisAddin.Designer.cs file:

1. Shut down Visual Studio
2. Change the namespace in ThisAddin.Designer.cs from VisioAddIn1 to your namespace
3. Save your changes
4. Reopen your project
5. Compile!