1

I've searched extensively and I followed loads of advice (pretty much all saying the same thing) with regards to this problem, but it still won't work.

I'm building a C# graphing application using Zedgraph, and using an SQLite database. I was still tweaking the DB until recently but now it's correct and I want to add it as a resource to my project, so that when I publish my Project, it's be part of the setup and will work with my application. I've added the resource the way one usually does it, and it's in my resources folder in the project. I have it set to Copy Always and it's as an embedded resource. I'm not sure if this is correct though. My application builds and runs fine from VS. But when I publish, it can't find my tables as the DB file is obviously missing.

How can I get the DB file working with the application so that I can distribute my app?

Thanks.

  • Do you see the file being published and in correct folder? – Abhinav Feb 12 '14 at 20:45
  • Hi, I've never had to do this before so I'm not sure what you mean by seeing the file being published? I just follow the wizard and then it takes me to the folder with the setup file - I don't see anything happening. Sorry about the noob-ness. Everything I've worked on so far either hasn't had a DB or is part of a way bigger project that has it's own build scripts so I never have to worry about these things! – user1261648 Feb 12 '14 at 20:49
  • Are you using a Visual Studio Installer Project? If yes, it might be that the file is not being included in the installer file. You can force-add it from the Dependencies in that project. – Abhinav Feb 12 '14 at 21:01
  • Check this one out for adding external files: http://stackoverflow.com/questions/6907536/add-another-exe-file-in-my-setup-file-in-visual-studio – Abhinav Feb 12 '14 at 21:03
  • That helped me a long way. I needed to change the build action to content, and then I could see it in the application files tab in publish (which I couldn't when I had set as an embedded resource) and then I set the publish status to include, and it worked! Thanks for your help! – user1261648 Feb 12 '14 at 22:03
  • Added an answer. you can accept it as an answer if you feel like :) – Abhinav Feb 12 '14 at 22:06
  • Embedded resource will be placed inside the assembly, you will need to extract it to disk before it will work. – Lasse V. Karlsen Feb 12 '14 at 22:08

1 Answers1

1

Are you using a Visual Studio Installer Project? If yes, it might be that the file is not being included in the installer file. You can force-add it from the Dependencies in that project.

Check this one out for adding external files.

Community
  • 1
  • 1
Abhinav
  • 2,085
  • 1
  • 18
  • 31