Error “The connection string is not valid” after upgrading to .slqproj

Today I upgraded a couple of projects from .dbproj to .sqlproj using Visual Studio 2010.

First problem: One of the new projects did not build, saying it lacked master.dacpac. So I had to copy that file from “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\100\SQLSchemas” to the “Master DB reference” folder within my project folder.

Second problem: When I checked in and the project was built using TFS/MSBuild, I got this error:

…\Binaries\Release\MyProjct.sql: The connection string is not valid

I didn’t want to publish directly to the database, because there is no network connection between our build server and the test server, but how do you turn that off? Unchecking Deploy for the project using solution configuration manager did not help.  After some binging, I found a clue. I opened up the project file using a text editor and changed

<Project DefaultTargets="Build;Deploy" xmlns="<a href="http://schemas.microsoft.com/developer/msbuild/2003">http://schemas.microsoft.com/developer/msbuild/2003</a>" ToolsVersion="4.0">

to

<Project DefaultTargets="Build" xmlns="<a href="http://schemas.microsoft.com/developer/msbuild/2003">http://schemas.microsoft.com/developer/msbuild/2003</a>" ToolsVersion="4.0">

That works. A file called MyProject_Create.sql is generated and I use that for deployment to the test server, where our application is reinstalled from scratch every night.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s