Featured post
deployment - Deploying c# application issues -
i have application 1 folder added right clicking project, selecting add folder. inside folder have xml files set build action:content, copy output directory: copy if newer (i have tried setting embedded resource) have few text files , on.
in bin/debug output directory have exe, folder xml, stand alone .txt files , on. problem is, if send exe friend try gets exception thrown.
say puts exe on desktop, programme @ point reads filenames of xml files in folder. uses following code
string[] filepaths = directory.getfiles(@"datasources\");
i assume because of this, when exe runs desktop, expect folder of .xml files in same place? have same type of exception when trying read .txt files too. doing wrong here?
thanks time
when reading files using relative paths 1 relative applications current directory. tip: in c# can see directory using environment.currentdirectory
.
so if create shortcut on desktop, need make sure right click shortcut , set "start in"-folder directory of application. way current directory set when started , relative paths relative path , not path of shortcut.
if moved exe file desktop need move resources needs, if wants folder named "datasources" have move folder well, or set current directory when start application.
- Get link
- X
- Other Apps
Comments
Post a Comment