none
Upgrading MS Office Excel workbook solution to .Net v4.5 in Visual Studio 2017 RRS feed

  • Question

  • I am trying to upgrade my MS Office Excel workbook solution to .Net 4.5 framework using VS2017. Originally my project was a VS2008 solution targeting .Net V3.5. I followed the below link to upgrade.

    https://msdn.microsoft.com/en-us/library/ee712587.aspx

    I removed the ExcelLocale1033 attribute from my AssemblyInfo file.

    I am able to build and publish the vsto workbook project now. However while launching the excel utility it is expecting the resource file of an assembly which is being referred in my project. Like, if my project refers A.dll, while running it throws an error message saying - 'File not found A.resources.dll'. But indeed no such dll exist saying A.resource.dll in my entire solution/utility.

    Below is exception message.

    ************** Exception Text **************
    System.TypeInitializationException: The type initializer for 'PROJECTNAME.METHODNAME' threw an exception. ---> System.TypeInitializationException: The type initializer for 
    'PROJECTNAME.NAMESPACE' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 
    'A.resources, Version=5.4.0.0, Culture=en-US, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
       at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
       at System.Reflection.Assembly.LoadFile(String path)

    Any help would be appreciated greatly.

    Thank you in advance.


    Wednesday, August 2, 2017 3:52 PM

All replies

  • Hello,

    According to the link,

    If you have an Excel or Word project that uses any of the following features, you must modify your code if the target framework is changed to the .NET Framework 4 or later:

    Do you use these features and do you modify your code?

    I suggest you share your project here. You could upload your project into OneDrive and paste the link here.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 3, 2017 3:00 AM
    Moderator
  • Dear Celeste,

    Thank you for the prompt response.

    My project had used following features from the provided list.

    I modified the respective codes as per the new syntax. Only after that the build errors got resolved. But still during runtime, i am facing the issue as illustrated above.

    Sharing the entire project will not be feasible due to my organization policy. But i can provide anything else which might be useful to you in helping me.

    Thank you again for quick turnaround.

    Kind Regards,

    Gurucharan

    Thursday, August 3, 2017 5:11 AM
  • What references do you include now? Could you debug the project and find what code causes the exception? What dll is not found in the exception message?

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 3, 2017 5:56 AM
    Moderator
  • Hi Celeste,

    Following is my solution hierarchy.

    • Proj A
    • Proj B
    • Proj C (Reference include Component.Design.Common.dll)
    • Proj D (Excel 2013 and Excel 2016 VSTO WorkBook Project) - Reference includes Proj A, Proj B and Proj C.

    Now when i debug the Proj D, exception is raised at a point when i call a function present in 'Proj C'.

    This exception says 'Component.Design.Common.Resources.dll' is not found.

    In fact, there is no such dll namely 'Component.Design.Common.Resources.dll

    I really appreciate your willingness to help with limited information.

    Kind Regards,

    Gurucharan

    Thursday, August 3, 2017 6:47 AM
  • Hello,

    I don't find any information online about "Component.Design.Common.dll", so I could not reproduce your issue.

    Do you upgrade Proj C in VS2017? Could you run the function when debug Project C in VS17? Please try to create a new project in VS17 and call the function from Project C to check if you would get any exception.

    For your old workbook project, please try to re-add the reference.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 3, 2017 8:22 AM
    Moderator
  • Hi Gurucharan,

    Per to your description, there are two files A.resources and Component.Design.Common.Resources.dll not found, are they the same file?

    Do you mean you did not use them anywhere in your entire solution?

    Based on your solution hierarchy, are all project A, B C and D converted to .NET 4.5?

    >> Now when i debug the Proj D, exception is raised at a point when i call a function present in 'Proj C'.

    Based on this, the exception thows when you call a function in Project C. If you create a new console application, reference Proj C and then call this function, will you get any error?

    Do you mean there is no other issue if you did not call this function in Proj D?

    It would be helpful if you could share us more information as you can.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 9, 2017 6:55 AM