Where is the DATA directory outputted to?

pizzaboy

Well-known member
Joined
Jan 5, 2008
Messages
57
Programming Experience
1-3
I've added the Setup Project to my program. Everything installs and runs fine (appears in the specified StartMenu, but the program can't seem to connect to the database in which outputted through the debug/bin, so...

where exactly does the DATA directory get outputted to?

Do I have to specifically define this in the Setup Project?


Any help would be greatly appreciated.

Thanks.
 
First up, it would be bin\Debug, and it should actually be bin\Release if you're releasing your app.

With regards to local data files and connection strings, if you use |DataDirectory| in your connection string then that will resolve to the folder the EXE was run from. If your database is there then your connection should be successful. The question is, is it there? Did you add the database to the Setup project? Generally, the data file's Build Action should be set to Content and then you add the Content output from your project to your Setup.
 
Haven't actually deployed anything before, so not 100% sure if I'm doing it correctly.

I simply added a Setup Project to my main program and the only thing I've set is the output pointing to my program.

Am I missing something? I've compiled the entire project. Prerequisites are being installed automatically by the installation, connecting to the internet. The setup appears to install correctly, but like I said, not really sure where the files are being outputted to (if at all). The program does run, and opens the initial Window I set. First and only error appears related to the database (I set a friendly messagebox.show under a Try block)...

Do I have to perform any extra changes to my Setup Project? Is Publish output not the same as the Release output? If so, how do I compile the Release output and get the Setup Project to correctly reference it?


Apologies for being a little long winded, but obviously having completed my project I need get a move on to get this finished.

Thanks.
 
If you can run the app then you can find out where it's being run from. Just look at the properties of the shortcut.

Publishing is building a ClickOnce installer, which is an alternative to the Windows Installer package created by building your Setup project.

If you want to output a Release build then change the build configuration from Debug to Release.

As I said, add the Content output of your project to the Setup, which should contain the data file.
 
If you decide to use ClickOnce, the |DataDirectory| redirect to a special data repository (ie different from application folder), when adding the db to project through the data source wizard it sets all this up automatically. You can also manually go to the Publish page and click 'Application Files' and set the publish status of the db file to "Data File" (and download group 'required'), this will cause it to be deployed to same dynamic DataDirectory location.
 

Latest posts

Back
Top