Upgrading a VSTO project from VS 2008 to 2013

To make sure all our Word documents are consistent we use a Word template that include VSTO action pane.


This allow us to insert standard blocks of text, T&C and the like, and also makes sure document revisions and reviews are correctly logged. We have used this for years without any issues, but I recently needed to make some changes to the underlying Word .dotx template and I had to jump through a couple of hoops to get it rebuilding in Visual Studio 2013 for Office 2013 (previously it had been built against Visual Studio 2008 generation tools)

The old VSTO project opened in Visual Studio 2013 without a problem, doing the one way upgrade. However, when I tried to build the project (which also signs it) I got the error

The "FindRibbons" task failed unexpectedly. System.IO.FileNotFoundException:   Could not load file or assembly 'BMAddIn, Version=, Culture=neutral,    PublicKeyToken=null' or one of its dependencies.   The system cannot find the file specified.

The  issue was that you need to remove the SecurityTransparent attribute from the end of the AssemblyInfo.cs file as detailed in MSDN.

Once this error was clear, I also got a problem when I tried to sign the assembly

error CS1548: Cryptographic failure while signing assembly. Unknown error (8013141c)

This was fixed by sorting the rights on my PC as I am running Visual Studio as a non-admin account. You need to give your current user ‘Full Access’ to C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys, or run Visual Studio as admin

So now it rebuilds and can be deployed I can make my modifications and enhance our VSTO solution, a much underused technology.