none
C#: Added MS Excel 16.0 Object Library but Error says Version=15.0.0.0 RRS feed

  • Question

  • Hi All,

    New bee asking the question after one day's searching on line.

    Visual Studio 2019 Community. Windows 365 version 16.0.12827.20328

    Added the reference "Microsoft Excel 16.0 Object Library", Version 1.9.

    Used the code "Application excel = new Application();"

    Then got error below:
    System.IO.FileNotFoundException: 'Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified.'

    I donot understand why the error is saying something like "version 15.0.0.0 is not found" when I specified version 16.0 when adding the reference.

    Could anyone tell me if I'm after the wrong clue?

    It would be even better if you can point me to the solution.

    Many thanks!

    VkS


    • Edited by VkS_in_use Tuesday, July 7, 2020 11:40 PM
    Tuesday, July 7, 2020 11:38 PM

Answers

  • Hello, 

    The file version can be different from what you see on the `Add Reference` dialog window. 

    Make sure the Copy Local property was set to true. 


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Marked as answer by VkS_in_use Thursday, July 9, 2020 1:25 AM
    Wednesday, July 8, 2020 3:46 PM

All replies

  • Hello, 

    The file version can be different from what you see on the `Add Reference` dialog window. 

    Make sure the Copy Local property was set to true. 


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Marked as answer by VkS_in_use Thursday, July 9, 2020 1:25 AM
    Wednesday, July 8, 2020 3:46 PM
  • Hi Eugene,

    Spot on! and 

    Thanks a lot! 

    Though i'm not quite sure what it really does, it sounds like to connect the Visual Studio to the local dll files, instead of letting it guess wildly towards the latest version.

    Cheers, mate!

    VkS_in_use

    Thursday, July 9, 2020 1:29 AM