Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio database project fails to publish, no error messages

I have several database projects in the same solution. They all fail to publish. My Visual Studio version is Enterprise 2015. My SQL Server version is 12.0.4459.0.

The projects used to publish correctly on my machine. They publish correctly on my co-workers machines. I've not changed the database projects from the correctly publishing versions on my co-workers machines.

The steps I use to publish are as follows:

  • I right click and select publish.
  • I load the publish profile from the xml file.
  • I click publish.

What I'd expect to happen: The Data Tools Operations window is displayed and the project publishes successfully.

What actually happens: The Data Tools Operations window is not displayed. On switching to the Data Tools Operations window it is empty. The project is not published. Visual Studio subsequently operates normally apart from when it is closed. On closing Visual Studio a dialog is displayed saying "The solution cannot be closed while publishing".

like image 950
Giles Roberts Avatar asked Aug 04 '16 15:08

Giles Roberts


People also ask

How do I link a database to Visual Studio?

To connect to your SQL Server database in Visual Studio start a new project and bring up Server Explorer either by clicking on the tab next to the Toolbox or by going to View > Server Explorer. Right click on 'Data Connections' then click 'Add Connection'.


1 Answers

Edit: The old answer below worked for me once but was intermittent on subsequent occasions. I then noticed that I was actually getting an error displayed in the bottom left hand corner of Visual Studio:

Exception from HRESULT: 0x80041FE2 The tab has been closed.

Searching on the above returned this article: https://connect.microsoft.com/VisualStudio/feedback/details/827417/vs-express-2013-cannot-reopen-any-open-file-tabs-and-silently-closes-them-on-selection

So I closed all my open tabs and was then able to publish.

Old answer: To resolve this issue after clicking Publish, instead of clicking Load Profile I clicked Edit and browsed to the database server. I then clicked Test connection. The test connection came back successful. I then clicked Load Values for my SQLCMD variables. On clicking Publish, the database project published successfully.

After following the above steps, I was then able to publish again by my usual method of clicking Load Profile on the Publish Database dialog.

like image 66
Giles Roberts Avatar answered Sep 21 '22 01:09

Giles Roberts