winforms - Location of user files with a ClickOnce application -


i have winforms app trying deploy clickonce. consists of executable , dependent dll, plus bunch of loose xml files in folder called "map". xml files seem present , correct in generated clickonce package , included in .manifest file.

however, when install , run, using following code gives me directory not found exception:

string apppath = path.getdirectoryname(application.executablepath); string mappath = path.combine(apppath, "maps"); foreach (string xmlfile in directory.getfiles(mappath, "*.xml")) 

when in "apppath" (which c:\users\mark\appdata\local\apps\2.0\0h6zlxxn.30v\3tno49oj.8jh\midi..tion_5194807c0e95e913_0000.0004_b9d52c73fd4d58ad\), there app executable , dll, maps folder not there.

what doing wrong? correct way bundling files application? maps folder somewhere user can access , add own files anyway.

ok, found code snippet helped me out. xml files being put clickonce "data directory" (this can configured using "application files" button on publish tab of project settings dialog. can @ data directory follows:

    private string getdatadirectory()     {         if (applicationdeployment.isnetworkdeployed)         {             return applicationdeployment.currentdeployment.datadirectory;         }         else         {             return application.startuppath;         }     } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -