connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TestDB;Integrated Security=True"
Once .exe.config file is generated, one can modify the .config file to change SQL Server name. Let's say one might want to put test SQL Server name. So this can be done manually, which is tedious way. Or one can add post build script to overwrite .config file.
There is another way - which is redirecting SQL Server to other server by using SQL Server alias. In some circumstances, this might be a better way.
Here is an example of how to redirect .\SQLEXPRESS server to TESTSERVER1 server.
(1) Run SQL Server Configuration Manager from Windows [Start] menu
(2) Expand [SQL Native Client 10.0 Configuration] -> [Alias]
(3) Click [New Alias] and type [Alias Name] and [Server] as follows.
(4) Click [OK]. Now the application will redirect .\SQLEXPRESS to TESTSERVER1 server.