Create a setup file for my project with SQL Server LocalDB database- c# vs2017?

0

I am having trouble with creating a setup file for my project in VS2017. I developed a Windows Forms application with C# and it uses a SQL Server LocalDB database.

So far and with the help of a tutorial, I installed Visual Studio Installer project and I created an empty setup project. In the application folder i added my project.exe and my database.mdf then hit build.

It generated my setup file and I installed it, the application works but when I try to open the database i am getting an error that says :

System.Data.SqlClient.SqlException (0x80131904): An attempt to attach an auto-named database for file C:\Program Files\NomadSysteme\GTC_Setup\db_alarme.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share

I believe it has something to do with my connection string which this is :

<connectionStrings>
    <add name="GTC_Frater_Razes.Properties.Settings.db_alarmeConnectionString"
         connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\db_alarme.mdf;Integrated Security=True"
         providerName="System.Data.SqlClient" />
</connectionStrings>

Is there something that should be installed in the target machine?

I am stuck at this problem for a week now so if someone can help me out that would be great.

c#
windows-installer
localdb
asked on Stack Overflow Apr 29, 2018 by lawir • edited Apr 29, 2018 by marc_s

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0