none
Difference between launching Excel then opening VSTO customized spreadsheet, or just opening VSTO customized spreadsheet from file explorer RRS feed

  • Question

  • My configuration at this point is:

     

    1)      Excel 2010 and Visual Studio 2010 Professional

    2)      I apply VSTO technology by creating a VB project using the “Excel 2010 Workbook” Office template in Visual Studio to create an assembly to support some custom interactions on my spreadsheet.

    3)      My customization of Excel interactions supports pushing some buttons on the spreadsheet which load and use a class library product to do some calculations, then update the spreadsheet with the results.

    4)      The class library product used on the backend of the solution is built against .NET 3.5, is a strongly named (i.e., in the GAC) mixed mode assembly (i.e., managed and unmanaged code) and cannot be rebuilt against .NET 4.0 at this time.

    5)      Through experimentation I determined that if I build the new  “Excel 2010 Workbook” support assembly against .NET 3.5 (instead of 4.0), everything seems to work and I do not seem to need a Excel.exe.config file – that’s very good.  I can debug the Excel support assembly, and run and interact with it so long as I open Excel first (i.e., double click on Excel.exe) then File->Open my custom spreadsheet.  If I don’t initialize this way, and just go double click on the custom spreadsheet (i.e., MySpreadsheet.xlsx), when I perform an interaction that requires the class library product  I receive the error – “Could not load file or assembly ‘ClassLibraryProductAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=602b1d95323bc3a5 or one of its dependencies.  The activation context being deactivated is not the most recently activated one.  (Exception from HRESULT: 0x80073704)”.

    6)    I did not see this difference running the same solution in Office 2007.  Both launching Excel then File->Open of the spreadsheet, or launching spreadsheet directly worked fine.

     

    Why the difference in behavior when I double click on spreadsheet?  What can I do about it?

     

    Thanks



    Thanks MDev6
    Tuesday, May 24, 2011 10:24 AM

All replies

  • Hi MDev6,

    From the description of your post, I think this scenario could be that your ClassLibraryProduct Assembly is not loaded when you just double click on the custom spreadsheet.

    As for the problem, I think it's better to deploy your application and include the prerequisites, we can use msi to deploy the vsto project, here is the code samples for you to reference:

    http://archive.msdn.microsoft.com/VSTO2010MSI/Thread/List.aspx

    After deploying the vsto, this problem should be resolved because all the neccessary dlls are included in the deployment package.

    Hope the suggestion can help you and just feel free to follow  up after you have tried.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Wednesday, May 25, 2011 1:22 PM
  • Hi MDev6,

    Have you resolved your problem yet, and does the suggestion help you? If you still have any concern on the thread, just feel free to follow up.

    Best Regards,




    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 3, 2011 6:51 AM
  • Thanks for the input Bruce, but I'm still having the problem.  I'm still unclear as to why I do not have the problem if I launch Excel first then File->Open the custom spreadsheet, but if I double click the custom spreadsheet directly I encounter the problem described.  I changed the application such that the ClassLibraryProduct is loaded when the spreadsheet is opened, but I have the same behavior (i.e., it works if I File->Open from Excel but doesn't when I double click the xlsx file).

     

    I don't understand your comment about the MSI and install pre-requisites.  It seems to me that I have everything I need installed if when I File->Open everything works fine.


    Again thanks for past and additional help.


    Thanks MDev6
    Friday, June 3, 2011 11:14 AM
  • Hi MDev6,

    We are doing the research about your problem. So, there might be some delay about the response. Appreciate your patience.

    And it will be nice if you can share your demo project on the skydrive: http://www.skydrive.com because your problem is difficult for us to reproduce.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, June 6, 2011 9:18 AM
  • Hi MDev6,

    What about the problem on your side? It is difficult to reproduce the problem on my side.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 7, 2011 10:43 AM