c# - System.IO.Directory.GetDirectories not working after publish -


i have c# application gets list of directories inside folder. done using call
string[] projects = system.io.directory.getdirectories("path/to/folder", "*", system.io.searchoption.topdirectoryonly);

this works fine on machine, after publishing (resulting in setup.exe, programname.application + application files) tried running program on new machine , threw unhandled exception error.

the error in regards being unable connect database, interesting part complaining path not being valid, listing path exists on machine.

does system.io.directory.getdirectories not reinitialized when running on machine?

i guess problem path/to/folder, path might not exist in new machine. don't hard-code path. instead read config file (app.config using configurationmanager).


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -