locked
VSIX how to access files copied to output directory RRS feed

  • Question

  • Hi,

    I am developing a VSIX which requires some set of text files which is used in the code.

    To achieve this I have added those sample files in Project and set their property as "Copy to Output Directory". So my files are getting copied however how can i access this file in code? Since when i checked it folder after installation. Folder Name inside Extension folder has some scrambled name instead of Extension name hence I cant even use UserDataPath property also.

    Can some one suggest how can i access files which will be copied to my output directly of extension. OR is there is a way to set folder name within Extension folder.

    FYI - my current extension folder path after installation is:

    C:\Users\Utkarsh\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\vz0k2een.o1t

    -

    Utkarsh Chauhan

    Tuesday, November 18, 2014 10:33 AM

Answers

  • Hi,

    Since both your files and the running assembly (your extension) are in the same folder, from within the extension you can call the static method:

    System.Reflection.Assembly.GetExecutingAssembly()

    and then use the Location property of the assembly.


    * My new blog about VSX: http://www.visualstudioextensibility.com * Twitter: https://twitter.com/VSExtensibility * MZ-Tools productivity extension for Visual Studio: http://www.mztools.com.

    Tuesday, November 18, 2014 1:59 PM