Reputation: 303
I've got an application that I'm moving over to ClickOnce and the app has a moderately sized data folder with hundreds of files that I need to inlcude in the deployment. The folder needs to be in the same place relative to the EXE after deployment. I've seen several suggestions on how to do this but there doesn't seem to be a agreed upon method for doing this.
Any suggestions would be great -
Thanks!
Upvotes: 30
Views: 27594
Reputation: 6612
https://msdn.microsoft.com/en-us/library/kzy0fky2.aspx
https://msdn.microsoft.com/en-us/library/6fehc36e.aspx
These two articles provide methods of doing this. Between the two of thing you can find one that works for you. The one that worked for me was:
With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Publish tab. Click the Application Files button to open the Application Files dialog box. In the Application Files dialog box, select the file that you wish to mark as data. In the Publish Status field, select Data File from the drop-down list.
Upvotes: 0
Reputation: 1443
One good way of doing this is:
--> when you publish the files will be put in that folder and be a part of the application installation
Good luck!
Upvotes: 53
Reputation: 17608
After deployment, all files marked as data are placed in the ApplicationDeployment.DataDirectory folder. I know of no way to change this. You could copy the data files during the first run of your app, but this approach will not survive any upgrades that include data file changes.
Alternatively if you have control over the location of the data folder during development, you can place in the same relative (to the app folder) location as will be specified after deployment.
Upvotes: 0