I have a similar issue but I'm using CLickOnce. At first I had User Instance = True with initial deployment. THen I realized what User Instance once and decided I didn't need it since it was going on a single user's assigned laptop.
THis is my app.config:
<
add name="connstring" connectionString="Data Source=(local)\SQLExpress;AttachDbFilename=|DataDirectory|\FDOT_TAT_C.mdf;Integrated Security=True;User Instance=False;" providerName="System.Data.SqlClient" />
This is a standard C# Windows Forms application. THe problem that I'm getting now is that I'm getting the following error message:
AN Attempt to attach to an auto-named database for file C:|Documents and Settings\kn854se\Local Settings\Apps\2.0\Data\E4MQOGJJ.5KT\.....\Data\FDOT_TAT_C.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
THe path is referenced in the error message is not the path of the .exe. From what I read about using the |DataDirectory| is that it looks in the same folder as where the.exe is running. If this is the case how do I tell CLickOnce to put the database in the same folder as the .exe?
Can someone please shed some light on this as I'm sure I'm not the only one that has gone through this.
THanks in advance for your time.
Santiago Perez