none
get the file path VSTO RRS feed

  • Question

  • Hi,

    I am doing an add-in on MS Project. Basically I have an embedded Excel file which I want to write on the same folder where the MSproject is located. How will I be able to get the exact location of the file?

    Thanks,

    Gilbert Wong

    Thursday, April 9, 2015 3:53 AM

Answers

  • First of all, make sure that the file is copied to the output folder each time you build the solution. Also don't forget to include the file to the add-in installer.  

    You can access the file using the following properties at runtime:

    string path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
    Don't forget to add the file name you need to open.

    • Marked as answer by L.HlModerator Monday, April 20, 2015 9:08 AM
    Friday, April 10, 2015 5:25 PM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the MSDN forum for Office DEV

    http://social.msdn.microsoft.com/Forums/en-US/home?forum=officegeneral&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    George Zhao
    TechNet Community Support


    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.

    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.
    Friday, April 10, 2015 1:47 AM
  • First of all, make sure that the file is copied to the output folder each time you build the solution. Also don't forget to include the file to the add-in installer.  

    You can access the file using the following properties at runtime:

    string path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
    Don't forget to add the file name you need to open.

    • Marked as answer by L.HlModerator Monday, April 20, 2015 9:08 AM
    Friday, April 10, 2015 5:25 PM