Q:

How do I set TargetConnectionString of SSDT Publish profile from AppConfig

We have recently moved to SSDT publish profiles, we have couple of sql servers to which our app can connect. 
Also, we have a SSDT Publish Profile for each server, thereby having a lot of .publish.xml files. 
Our app.config which contains SQLConnectionString is placed in startup project. 
Can I have my SSDT Publish profiles in a way, where I have only one profile and that read target connection string from app.config ? 
Please let me know if any clarification is needed thanks. 

A:

The way I give myself the most flexibility is to avoid using the publish and instead I have a set of powershell scripts which call sqlpackage.exe
You can then do whatever you like in powershell such as opening the app.config file for your app and getting the connection string. 
The only downside is that you don't get F5 publishing any more but in reality I haven't missed it. 
The overall process then becomes, build solution, run powershell (can be done from the immediate vs window or a seperate powershell win) and then so whatever I want to do. 
ed

