none
VSTO 2013 word add-in not loading for debug, and reporting "not a valid office add-in" when browse to load manually RRS feed

  • Question

  • I have a word add-in that was developed in VS2010, and ran with word 2013.    I then (last year) ported it to a different machine running VS2013, and thought it was working... some time passed and now I am having problems getting it to run.   It builds successfully with no errors.  BUT if I debug then the add-in does not load - and if I manually go to the bin/debug folder and select the dll then an error message reports that the dll is "not a valid Office Add-in".     

    In the process, the 2010 version of the code has somehow got corrupted so the word project will no longer load as part of the solution in VS.  Even when I have gone to earlier versions from TFS, it is still showing that the project is "unavailable" and that the "project can not be loaded".

    I have created a dummy test add-in in VS2013 which displays a message proving that it loads correctly.

    Any help appreciated.


    dw

    Tuesday, February 2, 2016 4:03 AM

Answers

  • HI - just to finalise this discussion I did sort it out eventually. I didn't try to repair VS as your logic of it being OK for the test word add-in made sense.  I did rebuild it from scratch and the same issue happened again.

    I found on some google search to try to delete the web.config (in my case the app.config) and to get it to regenerate automatically.  This seemed to fix the 'System.Configuration.ConfigurationErrorsException' error.

    I also had to make sure all my references to resources etc were correct, as that was affecting the ribbon labels.  I ended up using my original project rather than using the rebuilt one.    At one stage I had the add-in loading but the ribbon still was not loading, and that turned out to be due to incorrect naming in some of those background files. 

    I seemed to do a lot of fiddling (especially with exception settings and debug options) but eventually now it seems to be working back to normal - phew.   


    dw

    • Marked as answer by Di Williams Thursday, February 18, 2016 5:10 AM
    Thursday, February 18, 2016 5:09 AM

All replies

  • Hi dw,

    >> BUT if I debug then the add-in does not load

    How do you check whether the add-in is loaded or not? After you launch your VSTO project, I suggest you check whether your add-in is list in Add-ins->COM ADD-INS, and whether it is checked. If it is not checked, I suggest you check it to see whether this add-in load correctly.

    >>I have created a dummy test add-in in VS2013 which displays a message proving that it loads correctly.
    Do you mean it worked correctly with a new add-in in VS2013?

    >> I then (last year) ported it to a different machine running VS2013, and thought it was working
    How did you port it to VS2013? If you open it in VS2010, will it work? For Office addin does not load, I suggest you check the link below for a try.

    #My Office Addin does not Load!
    http://blogs.msdn.com/b/haahmadi/archive/2010/05/26/my-vsto-add-in-does-not-load.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, February 3, 2016 1:57 AM
  • Thanks Edward!

    >>How do you check whether the add-in is loaded or not?  

    It is not listed in COM Add-Ins.  There are no event logs written. The code breakpoints are marked as never going to be hit "no symbols loaded for this document".

    >>Do you mean it worked correctly with a new add-in in VS2013?

    I created a new add-in which pinged a server and displayed a message.  This runs every time I debug - ie it displays the msg, it shows as a COM add-in, and it allows breakpoints to be hit.

    >>How did you port it to VS2013? If you open it in VS2010, will it work?

    I used Visual Studio 2013 to convert the solution and then fixed various problems to get rid of errors etc.  It has no build errors but has a code analysis error of the type CA0001 member "xx" could not be found in type "yy" in assembly "zz".   I haven't been able to fix this. 

    I have managed to re-open an old version in VS2010 (from a manual backup of the component that was not able to load) and get it running, but it is also not loading in word. It is now saying "you cannot debug or run this project because the required version of Microsoft office is not installed". 

    The VS2013 machine has Word 15.0.4675.1000  MSO 15.0.4615.1000 32-bit     and the VS2010 machine has Word 15.0.4701.1001  MSO 15.0.4701.1000 32-bit.


    dw

    Wednesday, February 3, 2016 5:35 AM
  • Hi DW,

    >> It is not listed in COM Add-Ins

    With my above link, I suggest you check whether your add-in is installed correctly and it is enabled. And then I suggest you check whether your add-in is disabled. Open Word Options dialog (File->Options) and navigate to Add-Ins tab, check whether your add-in is list in Disabled applicaiton add-ins.

    >> It is now saying "you cannot debug or run this project because the required version of Microsoft office is not installed

    This error usually occurred when add-in template Office version is different from Office version you installed. But based on your description, it seems you both use Office 2013. Which template you used to create VSTO before, with VSTO 2010 template or VSTO 2007 template? When you test with VS2010, I think you need to install Office 2007 or Office 2010.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, February 3, 2016 9:25 AM
  • >> With my above link...

    The add-in should be loading when I run 'debug' from VS2013.  After running debug, it is not listed as an active or inactive add-in, and there are no disabled items.  The reg key for HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins does not list it.   The output window shows that referenced files are loaded for my test add-in but not for this specific add-in. I have set  "VSTO_SUPPRESSDISPLAYALERTS" environment variable to 0, and VSTO_LOGALERTS to 1 but nothing displays.  There is no DisabledItems key under HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\Resiliency.

    If I set to break for all exceptions, then there are 2 breaks, but I note the breakpoint  in the add-in startup routine has already turned to "no executable code of the debugger's target code type is associated with this line"  

    • A first chance exception of type 'System.Deployment.Application.DeploymentException' occurred in System.Deployment.dll     Additional information: Store metadata "CurrentBind" is not valid.
    • A first chance exception of type 'System.Security.Cryptography.CryptographicException' occurred in Microsoft.VisualStudio.Tools.Applications.Hosting.dll   Additional information: The subject is not trusted for the specified action.

    Progress!

    If I turn off code analysis, and after I have fiddled with lots of settings for exceptions etc, I am now getting the add-in running (!) but it is repeatedly displaying ConfigurationExceptions in the Settings.Designer.vb file   

    A first chance exception of type 'System.Configuration.ConfigurationErrorsException'   occurred in System.Configuration.dll    Additional information: Configuration system failed to initialize

    on the return statement in here:
    Public Property SharePointServerUrlGeneral() As String
    Get   
       Return CType(Me("SharePointServerUrlGeneral"),String)
    End Get
    Set
       Me("SharePointServerUrlGeneral") = value
    End Set
    End Property

    Then eventually

    An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll and wasn't handled before a managed/native boundary   Additional information: Exception has been thrown by the target of an invocation

    Then more errors as per the first one

    Eventually it starts word with the add-in loaded, but gives an error on the custom ribbon in a function "getLabel" - breaking at the point where the label is assigned shows that My.Settings.VersionNumber has a value of {Configuration system failed to initialise} - equivalent to the first exception listed above.

    >>Which template you used to create VSTO before, with VSTO 2010 template or VSTO 2007 template?

    The original code was developed by someone else in VS2010, I presume it was done with office 2010 template as it was designed to run with word 2010, then updated to run with word 2013. It has been running and building successfully for ages.  If I can get the VS2013 version running then I don't need to worry about the VS2010 version.


    dw

    Thursday, February 4, 2016 4:06 AM
  • Hi DW,

    I assume your VSTO project is broken. If you do not mind, I suggest you add code in a new VSTO project in VS2013 from original project.

    Sorry for any inconvenient.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, February 4, 2016 8:37 AM
  • Not the answer I was hoping for! It is a big solution with a lot of bits in it so will take a while to re-construct. I am wondering if my Visual Studio installation needs repairing... do you think that is also an option that might help ? 

    I did get a weird mixup from TFS yesterday afternoon where I tried to map and check out project X and it said I couldn't do it as project Y was already on my drive.   So it mixed up what 2 completely different team projects were...


    dw

    Thursday, February 4, 2016 10:34 PM
  • Hi DW,

    >> I am wondering if my Visual Studio installation needs repairing... do you think that is also an option that might help
    I think you could make a try. Why I do not suggest you repair in my previous post is your new project worked correctly.

    >> I did get a weird mixup from TFS yesterday afternoon where I tried to map and check out project X and it said I couldn't do it as project Y was already on my drive.   So it mixed up what 2 completely different team projects were
    Is there a work version in your TFS? For this, I suggest you download you project from TFS in a new pc to check whether this project could work.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, February 5, 2016 2:22 AM
  • HI - just to finalise this discussion I did sort it out eventually. I didn't try to repair VS as your logic of it being OK for the test word add-in made sense.  I did rebuild it from scratch and the same issue happened again.

    I found on some google search to try to delete the web.config (in my case the app.config) and to get it to regenerate automatically.  This seemed to fix the 'System.Configuration.ConfigurationErrorsException' error.

    I also had to make sure all my references to resources etc were correct, as that was affecting the ribbon labels.  I ended up using my original project rather than using the rebuilt one.    At one stage I had the add-in loading but the ribbon still was not loading, and that turned out to be due to incorrect naming in some of those background files. 

    I seemed to do a lot of fiddling (especially with exception settings and debug options) but eventually now it seems to be working back to normal - phew.   


    dw

    • Marked as answer by Di Williams Thursday, February 18, 2016 5:10 AM
    Thursday, February 18, 2016 5:09 AM