Forum Discussion

Thierry1967's avatar
Thierry1967
Copper Contributor
Mar 13, 2020
Solved

MSIX-package with using VC++ runtime redistributable (14.21.27702)

I have the following situation:

I have WinForms-application (used .NET Framework 4.7.2) which is starting Visio and loading a Visio Add-on (a VSL) which is using the VC++ runtime redistributable (14.21.27702). Visio and the VC++ runtime redistributables are installed locally on the Windows 10 system.

 

The WinForms-application is which is installed via a msix-package (made with InstallShield 2019R3; this msix is used in a sideloading scenario) is starting correctly. However when I start Visio from the WinForms-application Visio is started, but the Visio Add-on (VSL) is loading the following exception occurs:

 
System.Runtime.InteropServices.COMException (0x86DB08A9): Invalid parameter.
   at Microsoft.Office.Interop.Visio.AddonsClass.get_Item(Object NameOrIndex)

 

I have also made an AppV-package of the same WinForms-application and I start Visio from the WinForms-application and loading the Visio Add-on everything is going fine. The AppV-package is installed on the same machine as the Msix-package.

 

I have had the same issue with the AppV-package when the VC++ redistributable (14.21.27702) was not installed.

 

Does anyone have suggestions for what I could do?

 

Kind Regards,

Thierry

4 Replies

    • Thierry1967's avatar
      Thierry1967
      Copper Contributor

      Hi Dian Hartono,

       

      Thank you for your response.

      Visio is launched via the Microsoft Office Visio Interop. Example code (C#):

               VisioInterop.Application application = new VisioInterop.Application();

      The Visio addon is loaded also via the Microsoft Office Visio Interop. Example code (C#):

              protected override VisioInterop.Addon LoadMavimVslAddon()
              {
                  Microsoft.Office.Interop.Visio.Addon vslAddon = null;
                  try
                  {
                      // Return
                      short eventsEnabled = this._application.EventsEnabled;
                      bool showFileOpenWarnings = this._application.Settings.ShowFileOpenWarnings;
                      bool showFileSaveWarnings = this._application.Settings.ShowFileSaveWarnings;
                      this._application.EventsEnabled = (short)0;
                      this._application.Settings.ShowFileOpenWarnings = false;
                      this._application.Settings.ShowFileSaveWarnings = false;
                      vslAddon = this._application.LoadAddon(VslFilePath, "MavimVsl");
                      this._application.Settings.ShowFileOpenWarnings = showFileOpenWarnings;
                      this._application.Settings.ShowFileSaveWarnings = showFileSaveWarnings;
                      this._application.EventsEnabled = eventsEnabled;
                  }
                  catch
                  {
                      throw;
                  }
                  return vslAddon;
              }

       

      internal static class VisioExtensions
          {
              internal static Microsoft.Office.Interop.Visio.Addon LoadAddon(this Microsoft.Office.Interop.Visio.Application application, string addonFileName, string addonName)
              {
                  if (!System.IO.File.Exists(addonFileName))
                  {
                      throw new System.IO.FileNotFoundException();
                  }
                  application.Addons.Add(addonFileName);
                  Microsoft.Office.Interop.Visio.Addon addon = application.Addons[addonName];
                  return addon;
              }
          }

       

      LoadAddon is an extension method on the Visio application.

      The VslFilePath refers to the path where the addon is located and the addon is part of the msix-package. So the WinForms-application including the addon are packaged as a msix-package.

       

      Visio is installed locally on the machine (and is not packaged). I noticed that Visio is started from the WinForms application. However, when loading the Visio addon an exception occurs.

       

      I hope you have an idea what is happening.

       

      Kind regards,

      Thierry

       

      • Thierry1967's avatar
        Thierry1967
        Copper Contributor

        Hi Dian Hartono :

         

        Any news on this issue or is this architecture too complex for the MSIX-technology ?

         

        A .NET Framework Winforms Application which is launching Visio and subsequently loading a Visio Addon (VSL) which uses the VC++ runtime redistrutable. Furthermore are the .NET Framework Winforms Application and Visio Addon (VSL) communicating with each other via the WCF technology. 

         

        Do I have to include Visio as wel in the MSIX-package in some way?

         

        As earlier mentioned with an AppV-package this is all working...

         

        Kind regards,

         

        Thierry 

Resources