Link to home
Start Free TrialLog in
Avatar of Skale
Skale

asked on

How to create default folder structure with publish of application in vb.net

I'm working on application which requires different type of inputs and i'm storing that required files and folder in my "Release" output folder.

Also i'm using that paths in mycodes like below format;

 Dim dbDir As String = Path.Combine(Environment.CurrentDirectory, My.Settings.str__data_dir, My.Settings.str__data_db)

Open in new window


In fact when i'm running in "Release" , Environment.CurrentDirectory is D:\TestCode but after i published the code all my paths is changed to RoamingData folder as you can see on error message when my application didn't found the path.

User generated image
After that  i asked a question and realize i shouldn't built my path structure to Environment.CurrentDirectory.

So now i wonder when we're installing a commerical software that comes with several folder structure(like below image), what's the approach that programs use this directories.

I'm asking this because i'll be creating different folder structures and i want to access them in all cases.

Any help would be grateful.

User generated image
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Hi Hakan,


Using current working directory is a right approach. In your case things might not have worked as it expects files to be deployed along with the folder.

And Environment.CurrentDirectory will always give you fully qualified path of the current working directory.

If you are not setting it manually or by mistake, and if you start your app from D:\TestCode, it should look for the database under D:\TestCode only.

Regards,
Chinmay.
Avatar of Skale
Skale

ASKER

Hi Chimnay,

It's published as ClickOnce application. Is that causing that ?
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial