none
exception error of add an Excel add-in ribbon in a web application from VS2010 debug mode on win7 RRS feed

  • Question

  • I have published a web service (built in VS2010, .NET 4.0) successfully in my desktop with IIS7.5 win 7 from my laptop.

    The C# solution is composed of

        MyApp.Host , MyApp.Excel, MyApp.WCF, MyApp.Web, MyAppSetup

    Now, I need to run the C# code in VS2010 in debug mode.
    I have installed VS2010 tools for office runtime. When my application is opened, it will add a tab (an add-in) in Excel 2010. I have copied
          
         MyApp.Excel.dll
         MyApp.Excel.dll.config
         MyApp.Excel.dll.manifest
         MyApp.Excel.vsto
         MyApp.Excel.xlsx
         Microsoft.Office.Tools.Common.dll
         Microsoft.Office.Tools.Common.v4.0.Utilities.dll
         Microsoft.Office.Tools.dll
         Microsoft.Office.Tools.Excel.dll
         Microsoft.Office.Tools.Excel.v4.0.Utilities.dll
         Microsoft.Office.Tools.v4.0.Framework.dll
         Microsoft.VisualStudio.Tools.Applications.Runtime.dll
         Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll
         Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0.dll     

    to the folder un my C# solution

        MyApp.Host\bin\debug\

    because these files were published to my desktop.
     
    But, I still got error

          ************* Exception Text **************
          System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
          at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
          at System.Reflection.RuntimeModule.GetTypes()
          at System.Reflection.Assembly.GetTypes()
          at Microsoft.Office.Tools.Excel.WorkbookImpl.CreateRibbonObjects()
          at Microsoft.Office.Tools.Excel.WorkbookImpl.WorkbookExtensionImpl.Microsoft.Office Tools.Excel.IWorkbookExtension.CreateRibbonObjects()  at Microsoft.Office.Tools.Excel.WorkbookImpl.GetRibbonObjects()

    Do I miss some tools or libs here ?

    Friday, June 26, 2015 3:12 AM

Answers

  • hi usa2015usa,
       As per this case, you may try to update your config file in the corresponding .Net application like below:
    <configSections>
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
            <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
            </sectionGroup>
          </sectionGroup>
        </sectionGroup>
    </configSections>
    Tuesday, June 30, 2015 9:01 AM

All replies

  • hi usa2015usa,
       As per this case, I suspect that the issue occurred because of missing this library as  "Microsoft.Office.Interop.Excel.dll".

    for that ,you can do the following steps:

    1. On the Project menu, click Add Reference.
    2. On the COM tab, locate Microsoft Excel Object Library, and then click Select. In Visual Studio 2010, locate Microsoft Excel XX.X Object Library on the COM tab.
    3. Click OK in the Add References dialog box to accept your selections. If you are prompted to generate wrappers for the libraries that you selected, click “Yes”.

    for more information, refer the following links :

    1. Click here to refer about Office Primary Interop Assemblies.

    2. Click here to refer about How to: Install Office Primary Interop Assemblies.

    Monday, June 29, 2015 3:21 AM
  • Hi,

    After installing "Microsoft.Office.Interop.Excel.dll", I still got the same error:

    ************** Exception Text **************
    System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
       at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
       at System.Reflection.RuntimeModule.GetTypes()
       at System.Reflection.Assembly.GetTypes()
       at Microsoft.Office.Tools.Excel.WorkbookImpl.CreateRibbonObjects()
       at Microsoft.Office.Tools.Excel.WorkbookImpl.WorkbookExtensionImpl.Microsoft.Office.Tools.Excel.IWorkbookExtension.CreateRibbonObjects()
       at Microsoft.Office.Tools.Excel.WorkbookBase.CreateRibbonObjects()
       at Microsoft.Office.Tools.Excel.WorkbookBase.Microsoft.Office.Tools.Excel.IWorkbookExtension.CreateRibbonObjects()
       at Microsoft.Office.Tools.Excel.WorkbookImpl.GetRibbonObjects()
       at Microsoft.Office.Tools.Excel.WorkbookImpl.CreateRibbonExtensibilityObject()

    Any help would be appreciated.

    Monday, June 29, 2015 3:05 PM
  • hi usa2015usa,
       As per this case, you may try to update your config file in the corresponding .Net application like below:
    <configSections>
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
            <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
            </sectionGroup>
          </sectionGroup>
        </sectionGroup>
    </configSections>
    Tuesday, June 30, 2015 9:01 AM