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.

Note
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: