locked
An Add-in Could not be found or could not be loaded. RRS feed

  • Question

  • Hiii
    I develop Excel 2007 Addins using vb.net and vsto. and when i  create setup and run on client machine. it shows the following error :
    office document customization is not available.
    An Add-in Could not be found or could not be loaded.

    and the show the detail of this error is following:

    Could not load file or assembly 'ExcelVstoAddin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)


    ************** Exception Text **************
    System.IO.FileLoadException: Could not load file or assembly 'ExcelVstoAddin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
    File name: 'ExcelVstoAddin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.
       at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
       at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.HandleOnlineOffline(Exception e, String basePath, String filePath)
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadStartupAssembly(EntryPoint entryPoint, Dependency dependency, Dictionary`2 assembliesHash)
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ConfigureAppDomain()
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadAssembliesAndConfigureAppDomain(IHostServiceProvider serviceProvider)
       at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadEntryPointsHelper(IHostServiceProvider serviceProvider)




    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    msosec
        Assembly Version: 7.0.5000.0
        Win32 Version: 7.10.5077.0
        CodeBase: file:///C:/WINDOWS/assembly/GAC/msosec/7.0.5000.0__b03f5f7f11d50a3a/msosec.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.Runtime
        Assembly Version: 8.0.0.0
        Win32 Version: 8.0.50727.940
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    Microsoft.Office.Tools.Common
        Assembly Version: 8.0.0.0
        Win32 Version: 8.0.50727.940
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------


    What can i do for this error. plz solve my problem. Thanx
    Mitesh Khatri
    khatrimitesh@hotmail.com



    Friday, May 9, 2008 8:28 AM

Answers

All replies

  • Hi Mitesh,

     

    Did you set the CAS policy for your add-in?

     

    Friday, May 9, 2008 11:47 PM
  • Hi Mitesh,

     

    As Peter already said, your issues seems to caused from assembly not granted full trust.

    About how to use caspol to grant full trust to Add in assembly, you can refer the following MSDN document.

    http://msdn.microsoft.com/en-us/library/zdc263t0.aspx

    Hope this helps!

     

    Thanks,

    Ji

     

    Tuesday, May 13, 2008 8:34 AM
  • I'm having the same issue using VSTO 2005 SE targeting Word.  Works fine when running on the local workstation, but after publishing the project, it continues to have this error.  Permissions have been set to Full Trust using the 2.0 Config Tool.  All permissions have ben checked and re-checked.  I've yet to see a definitive solution to this problem published.  Hope someone has solved this problem earlier and can explain what is going on.

    Thanks in advance.
    Monday, October 13, 2008 11:05 PM
  • Hi All,

    As per my requirement, I have to create 2 Add-ins (One for power point and another for word).

    I am using vsto 2008 with office 2007
    I successfully created the add-in for power point but when I am creating an add-in for word 2007 then I get following error on the development machine itself.  



    "an add-in could not be found or could not be loaded"

    Cannot access a disposed object.
    ************** Exception Text **************
    System.ObjectDisposedException: Cannot access a disposed object.
       at Microsoft.Office.Tools.SmartTagCollection.BeginInit()
       at WordAddIn.ThisAddIn.BeginInitialization() in C:\ThisAddIn.Designer.vb:line 128
       at WordAddIn.ThisAddIn.InitializeDataBindings() in C:\WordAddIn\ThisAddIn.Designer.vb:line 65
       at Microsoft.VisualStudio.Tools.Office.EntryPointComponentBase.Microsoft.VisualStudio.Tools.Applications.Runtime.IEntryPoint.InitializeDataBindings()
       at Microsoft.VisualStudio.Tools.Applications.AddInAdapter.ExecutePhase(ExecutionPhases executionPhases)
       at Microsoft.VisualStudio.Tools.Office.Internal.OfficeAddInAdapter.InitializeEntryPointsHelper()


    So just to test the cause of the above error I removed all the code and tried to run the add-in file (but I get the same error).

    Power point addin and word addin both are created on the same machine, then Why do I get an error for word addin.

    I tried to give full trust to this assembly using caspol.exe (this is mentioned in one of the blogs). But it did not help.

    What should I do to get this working. Please suggest
    Wednesday, February 25, 2009 5:50 AM
  • I faced the same problem when I developed a simple Word 2007 add-in and got the same error: "An Add-in Could not be found or could not be loaded"

    I was able to solve the problem by downloading Microsoft Office System  2007 Primary Interop Assemblies from the link:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&DisplayLang=en 

    I hope this may help others who search for the same problen in the future.
    Wednesday, August 5, 2009 4:15 PM