none
Error : Not Loaded. A runtime error occurred during the loading of the com addin

    Question

  • Hi All
    I m working on Excel-2007 Add ins with vb.net 2005. I develop a Excel Add Ins and Create A Setup for this add ins. when i install this setup on other computer this add in are not working and When i click on
    menu-Excel-Option-Add Ins-Manage Add Ins and myAddin. then this Error Msg Are Show There...
    "Not Loaded. A runtime error occurred during the loading of the com addin"
    Thanx
    Mitesh
    Monday, March 24, 2008 2:41 PM

Answers

  • Hi Mitesh,

     

    Follow these steps which always work for me.

    1.       Open Visual Studio 2005, create an Excel 2007 Add In using VSTO template under VB->Office->2007 Add-ins node. Then, there will be two projects in Solution Explorer Window. One is ExcelAddIn, another is ExcelAddInSetup.

    2.       In ThisAddIn.vb file, type a statement of MessageBox in ThisAddIn_Startup method. It will be used to verify that your Add In is installed correctly later.

          Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

            Windows.Forms.MessageBox.Show("Deploy successfully")

    End Sub

    3.       In Solution Explorer Window, right click ExcelAddInSetup project, and click Build

    4.       In your ExcelAddInSetup project’s debug sub folder, copy ExcelAddInSetup.msi to your Client machine.

    5.       Now, we need to prepare the client machine with prerequisites. Install the following things on client machine:

    .Net Framework 2.0 http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en

    Office 2007 PIA: http://www.microsoft.com/downloads/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513&displaylang=en. After you download and install it, you will get a file o2007PIA.msi. Install this msi file.

    VSTO Runtime 2.0: http://www.microsoft.com/downloads/details.aspx?FamilyId=4468D8CB-B43E-4B09-82F6-8BA3F7B5E935&displaylang=en#filelist

    6.       Double ExcelAddInSetup.msi you copied in step 4 to install the Add In on client machine. Assume that we install the Add In in “C:\Test\”

    7.       Show your desktop, click Start->Run, type “cmd”, click OK. The command line window pops up. In the command window, type “cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727”. And then type “Caspol –u –ag All_Code –url “C:\Test\ExcelAddIn.dll” FullTrust –n “Test” ”. It will ask you: Are you sure you want to perform this operation? Type “yes”, press Enter.

    8.       Open your Excel in client machine(make sure your Add In is checked in the COM Add In Dialog), there should pops up a message box tells “Deploy successfully”.

    Try above setups. If any questions, please feel free to follow up and let me know your difficulty.

     

     

    Thanks,

    Ji

     

    Friday, March 28, 2008 7:43 AM

All replies

  • This error message has been discussed a number of times here in the forum. Here's the set of search results. See if the discussions lead you to an answer?

     

    Monday, March 24, 2008 3:40 PM
  • Hiiiiiiii
    The Error "
    Error : Not Loaded. A runtime error occurred during the loading of the com addin" are Dicussed very time but i not get the solution for this problem. so plz send me solution of this probolem
    Thanx
    Mitesh

    Tuesday, March 25, 2008 10:56 AM
  • Hi Mitesh,

     

    We need to check the following things,

    1. Prerequisites: we need install same version of Office and Office PIAs, .Net Framework, VSTO runtime.

    You can check Office PIAs by seeing if Microsoft.Office.Interop.Excel exists in C:\Windows\Assembly

    You can check .NET Framework and VSTO Runtime in Add/Remove Programs.

     2. Registry: if you are using a system created Setup project, you do not need to worry about this. But, I see that you say you create a setup project. Then you need to use the registry view to add all registry information manually. All registries in the following link are need:

    http://msdn2.microsoft.com/en-us/library/bb386106.aspx

     3. Permission: To let VSTO Add In run, the assembly must be granted full trust. You can use verify this using caspol command line

    Open Visual Studio Command Prompt, type "caspol -u -lg" to see if your Add In is listed there.

    If not, you need to use caspol to grant full trust to your Add in and referenced assembly, see this document:

    http://msdn2.microsoft.com/en-us/library/zdc263t0(VS.80).aspx

     

     

    Thanks,

    Ji

     

    Thursday, March 27, 2008 8:07 AM
  • Hiiiiii JI
    i use the system created Setup project. and i also install the vsto runtime and i do every thing. but problem is not solved. Plz tell me what can i do.
    From
    Mitesh
    Thursday, March 27, 2008 12:01 PM
  • Hi Mitesh,

     

    Follow these steps which always work for me.

    1.       Open Visual Studio 2005, create an Excel 2007 Add In using VSTO template under VB->Office->2007 Add-ins node. Then, there will be two projects in Solution Explorer Window. One is ExcelAddIn, another is ExcelAddInSetup.

    2.       In ThisAddIn.vb file, type a statement of MessageBox in ThisAddIn_Startup method. It will be used to verify that your Add In is installed correctly later.

          Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

            Windows.Forms.MessageBox.Show("Deploy successfully")

    End Sub

    3.       In Solution Explorer Window, right click ExcelAddInSetup project, and click Build

    4.       In your ExcelAddInSetup project’s debug sub folder, copy ExcelAddInSetup.msi to your Client machine.

    5.       Now, we need to prepare the client machine with prerequisites. Install the following things on client machine:

    .Net Framework 2.0 http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en

    Office 2007 PIA: http://www.microsoft.com/downloads/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513&displaylang=en. After you download and install it, you will get a file o2007PIA.msi. Install this msi file.

    VSTO Runtime 2.0: http://www.microsoft.com/downloads/details.aspx?FamilyId=4468D8CB-B43E-4B09-82F6-8BA3F7B5E935&displaylang=en#filelist

    6.       Double ExcelAddInSetup.msi you copied in step 4 to install the Add In on client machine. Assume that we install the Add In in “C:\Test\”

    7.       Show your desktop, click Start->Run, type “cmd”, click OK. The command line window pops up. In the command window, type “cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727”. And then type “Caspol –u –ag All_Code –url “C:\Test\ExcelAddIn.dll” FullTrust –n “Test” ”. It will ask you: Are you sure you want to perform this operation? Type “yes”, press Enter.

    8.       Open your Excel in client machine(make sure your Add In is checked in the COM Add In Dialog), there should pops up a message box tells “Deploy successfully”.

    Try above setups. If any questions, please feel free to follow up and let me know your difficulty.

     

     

    Thanks,

    Ji

     

    Friday, March 28, 2008 7:43 AM
  • Hiii Ji
    I write these lines in my project

    Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

            Windows.Forms.MessageBox.Show("Deploy successfully")

    End Sub

    and also install the framework 2.0,3.0 vsto and vstor on development machine and client machine. and also install the PIA on both machine. and also use the command windows and use caspol command for full trust. but my problem is not solved.
    When i compile my programme on any machine and  then open the excel then the add-in-menu (Created by my add ins) is displayed in excel and the add in is displayed in com -Add in.
    But when i run the setup. setup installed successfully. But in the excel  option-> Add Ins-Com Addins- the error are occurred "Load Behaviour :Not Loaded. A run time error during the loading of com add ins." when i try to checked it and click ok. but not effect on my excel.
    and when i try to add mannually in excel then it show a error msg that are "<ExcelAddIns> not a valid add in."
    so plz help to solve my problem
    Thanx
    Mitesh Khatri


    Friday, March 28, 2008 2:51 PM
  • Hiii
    Thanx for reply my query...
    i want to full trust a folder.
    if i do manually using caspol.exe and then run the Excel add in. it run successfully.
    i want to full trust a folder dynamically using vb.net code. how i do this....
    Plz help
    Thanx in Advance.
    Mitesh Khatri
    khatrimitesh@hotmail.com
    Monday, May 05, 2008 6:19 AM
  • Mitesh,

    Do you manage to solve the error? I have the same error as well. Please share if you manage to solve. Thanks a lot!

    Wooi Fun
    Thursday, May 07, 2009 6:51 AM
  • Mitesh,

    To full trust a folder, perhaps you can try <folder name>/* instead of the dll. E.g. type Caspol –u –ag All_Code –url “C:\Test\*” FullTrust –n “Test”, replacing Caspol –u –ag All_Code –url “C:\Test\ExcelAddIn.dll” FullTrust –n “Test”. Hope this helps.

    Btw, I've managed to solve the error and my add-in is now running as expected. 

    Wooi Fun

     

     

     

    Thursday, May 07, 2009 8:53 AM