I am creating C# Windows Application in Visual Studio 2015.
Question:
How to deploy C# Windows Application (setup file) with SQL Server database with database connection string.
I create common connection string in app.config :
<connectionStrings>
<add name="conString"
providerName="System.Data.sqlclient"
connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=
'C:\Users\DEVELOPERS\Documents\Visual Studio 2015\Projects\Provision1\
Provision1\provision1.mdf';Integrated Security=True"/>
</connectionStrings>
Now connection string path location shows my machine.
Then after installation .exe how to connect database and how to manage connection string on client machine.
The easiest way you can do is:
If you definitive need a setup.exe which installs your software, you can make a new project which is of type setup-programm. Watch this link for description.
If you don't want your users to see the connectionstring you can use a ConnectionStringBuilder. Save just a part of your connection string to app.config and build the rest via Quellcode. Watch this MSDN-Article.