How to troubleshoot the error message: "The following Microsoft Office solution cannot be installed due to a general installer error: .vsto. 0x80131604" when trying to install a VSTO 2010 Add-in.

 

    Suppose you develop a simple VSTO Add-in using Visual Studio 2010 and you target the .Net Framework 4.0. When you finish setting up the application’s basic functionalities, you want to test if it runs.

Here is a very basic Excel add-in, that should load without any issues:

ThisAddIn.cs----------------------------------------------------------------------

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using Excel = Microsoft.Office.Interop.Excel; using Office = Microsoft.Office.Core; using Microsoft.Office.Tools.Excel;

namespace ExcelAddIn_PivotTableUpdateEvent { public partial class ThisAddIn { public Excel.Application xlApp; private void ThisAddIn_Startup(object sender, System.EventArgs e) { xlApp = this.Application;             xlApp.SheetPivotTableUpdate += new Excel.AppEvents_SheetPivotTableUpdateEventHandler (xlApp_SheetPivotTableUpdate); System.Windows.Forms.MessageBox.Show("ExcelAddIn_PivotTableUpdateEvent - Startup!"); }

        void xlApp_SheetPivotTableUpdate(object Sh, Excel.PivotTable Target) { System.Windows.Forms.MessageBox.Show("SheetPivotTableUpdate Event"); }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { }

        #region VSTO generated code

        /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion } }

 

* When you try to compile and execute the project from the Visual Studio 2010 IDE, everything is OK and the start-up message box is displayed, meaning that the add-in had been correctly installed.

1

** But if you try browse to the Release/Debug project folder and install the solution by double-clicking on its <add-in name>.vsto deployment manifest file, then you may receive this message:

The following Microsoft Office solution cannot be installed due to a general installer error: <add-in name>.vsto.

0x80131604

 

************************************************************************************************************************ 

Hmmm… what do we do now ? Answer: apply some basic troubleshooting steps: (read https://blogs.msdn.com/b/haahmadi/archive/2010/05/26/my-vsto-add-in-does-not-load.aspx - My Office Addin Does Not Load! )

  • Check the registry entries: nothing is there.

> you try to create them:

[HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\ExcelAddIn_PivotTableUpdateEvent] "Description" ="ExcelAddIn_PivotTableUpdateEvent" "FriendlyName" ="ExcelAddIn_PivotTableUpdateEvent" "LoadBehavior" =dword:00000003 "Manifest"=file:///C:/ExcelAddIn_PivotTableUpdateEvent/ExcelAddIn_PivotTableUpdateEvent.vsto|vstolocal

  • Check the “COM Add-ins” dialog in Excel: the add-in is disabled.
  • Set the "VSTO_SUPPRESSDISPLAYALERTS" environment variable to 0. Set the "LoadBehavior" key’s to value to 3 and start Excel again.

> this time you get:

<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2"> <framework targetVersion="4.0" profile="Client" supportedRuntime="4.0.30319" /> <framework targetVersion="4.0" profile="Full" supportedRuntime="4.0.30319" /> </compatibleFrameworks>

************** Exception Text ************** Microsoft.VisualStudio.Tools.Applications.Deployment.FrameworkVersionMismatchException: <compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2"> <framework targetVersion="4.0" profile="Client" supportedRuntime="4.0.30319" /> <framework targetVersion="4.0" profile="Full" supportedRuntime="4.0.30319" /> </compatibleFrameworks> at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstaller.Install(ClickOnceAddInDeploymentManager clickOnceAddInDeploymentManager, OfficeAddInDeploymentManager officeDeploymentManager, AddInInformation& info) at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstaller.ProcessInstallerOperation(ClickOnceAddInDeploymentManager clickOnceAddInDeploymentManager, OfficeAddInDeploymentManager officeAddInDeploymentManager, AddInInformation& info) at Microsoft.VisualStudio.Tools.Office.Runtime.SolutionInstaller.ProcessInstallerOperation(ClickOnceAddInDeploymentManager clickOnceAddInDeploymentManager, OfficeAddInDeploymentManager officeAddInDeploymentManager, Boolean showUIDuringDeployment) at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.CreateCustomizationDomainInternal(String solutionLocation, String manifestName, String documentName, Boolean showUIDuringDeployment, IntPtr hostServiceProvider, IntPtr& executor)

************** Loaded Assemblies ************** …..

.. OK, this error does not give us much information. Let’s try to check out the Event Log.

Unfortunately, the event logging on my machine was disabled ! When I enabled it, the error was gone.

2

 

According to the blog entry: https://social.msdn.microsoft.com/Forums/en/vsto/thread/07c29bd3-94e9-4244-9bdf-2025bafd7621 (VSTO install error 0x80131604), the same behavior can also trigger if the Application Event Log is full.

For some reason it seems that default value ‘Overwrite events older than 7 days’ for the 'Log Size' setting in some cases will still cause the the Application Log to be filled-up (Start -> Run -> Eventvwr –> right-click on Application and select Properties –> General). 

To solve it, set this setting to "Overwrite events as needed" which means that you get an infinite log, and when new events come oldest events will be overwritten and clear the application log events.