esastincy
esastincy

Reputation: 1627

Visual Studio Database Project Generate Script

I just took over a project that is using a VS Database project and I am hitting an early road block. There is a file localhost.publish.xml that I am assuming will build the local database (is that correct)? When I click Generate Script I am getting the error "Unable to connect to the target server" and everything I have read online talks about installing the Data Tools which I did and it isn't helping. It has been a few years since I have even opened Visual Studio so I know I am just missing the obvious, but I cant find documentation anywhere that is giving me a clue about what I am missing. I havent included any of the code because at this point I am not even sure what would be helpful to anyone.

Upvotes: 4

Views: 15015

Answers (1)

Keith
Keith

Reputation: 21224

When you double-click localhost.publish.xml and it opens the Publish Database dialog, take a close look at the Target Database Connection. Make sure this is the database where you plan to run the SQL script and that this is a valid server you can connect to. Click the Edit button to change it. Your problem is either a) this is not a valid server, or b) you can't connect to this server from your computer (different network, firewall rules, etc).

The reason Visual Studio needs to connect to the database in order to generate the script is that it needs to determine if the script should contain CREATE or ALTER statements for your db objects based on whether or not they already exist.

Upvotes: 1

Related Questions