Technology Toolbox

Your technology Sherpa for the Microsoft platform

Jeremy Jameson - Founder and Principal



Bug Deploying SQL Server Database Using VSDBCMD.EXE

This post originally appeared on my MSDN blog:

Since I no longer work for Microsoft, I have copied it here in case that blog ever goes away.

Yesterday we encountered a bug while trying to deploy a new SQL Server database from a Visual Studio database project using the VSDBCMD.EXE utility, following the prescriptive guidance on MSDN:

How to: Prepare a Database for Deployment From a Command Prompt by Using VSDBCMD

According to this MSDN article, all you need to do is copy some files to the server running Microsoft SQL Server, and then run the VSDBCMD.EXE utility (specifying your .dbschema or .deploymanifest file).

Unfortunately, when we attempted to deploy our database to our Test environment, we encountered a NullReferenceException:

Object reference not set to an instance of an object.

Fortunately, it didn't take long to find Gert's recommendation to add the following registry key:

reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0

The error occurred since Visual Studio has never been installed on the SQL Server in TEST (unlike our local development VMs).

It certainly would be nice if the above MSDN article were updated to note the bug and associated workaround.

As pointed out in a comment by Ramkumar Perumal, Microsoft.SqlServer.BatchParser.dll does not exist in any of the specified folders. This should also be reflected in the MSDN article.

You will also find instructions to add the registry key -- as well as an explanation for why you more than likely already have Microsoft.SqlServer.BatchParser.dll installed on your SQL Server -- in the following blog post:


No comments posted yet.

Add Comment

Optional, but recommended (especially if you have a Gravatar). Note that your email address will not appear with your comment.
If URL is specified, it will be included as a link with your name.

To prevent spam from being submitted, please select the following fruit: Cherries

Please add 6 and 8 and type the answer here: