Wednesday, 14 April 2010

vsdbcmd.exe fails with error 0x8007000B

How to: Prepare a Database for Deployment From a Command Prompt by Using VSDBCMD.EXE shows how to upgrade the schema of a database on a remote server. However I encountered a problem this week running vsdbcmd.exe on a Windows Server 2008 R2 64bit machine:

vsdbcmd.exe /action:deploy /dd+ /manifestFile:Project.Database.deploymanifest
An unexpected failure occurred: An attempt was made to load a program with an in correct format. (Exception from HRESULT: 0x8007000B)

This error normally implies that you've got a mismatch between 32bit and 64bit dlls. I'd copied the DLLs from my Windows 7 32bit development virtual machine, so that made some sense.

It was suggested I copy the DLLs from a 64bit machine, but unfortunately that had no effect. I then noticed that some of the sqlce dlls did appear to be 32bit-specific.

I then downloaded and installed both the 32 and 64bit versions of SQL Compact 3.5 SP2 on the server, and removed the original sqlce dlls that I'd copied along with vsdbcmd.exe.

That seems to have fixed the problem – vsdbcmd now executes correctly.

So the actual list of DLLs ended up copying to the server now that the SQL Compact files are already installed are:

  • Extensions (folder)
  • DatabaseSchemaProviders.Extensions.xml
  • Microsoft.Data.Schema.dll
  • Microsoft.Data.Schema.ScriptDom.dll
  • Microsoft.Data.Schema.ScriptDom.Sql.dll
  • Microsoft.Data.Schema.Sql.dll
  • Microsoft.Data.Schema.Utilities.dll
  • System.Data.SqlServerCe.dll
  • vsdbcmd.exe
  • vsdbcmd.exe.config


Pete said...

Thanks for the post, it helped me to get vsdbcmd to work, but now I get an error that it cant find Microsoft.SqlServer.BatchParser.dll. The machine doesnt have MSSQL installed. I am trying to copy the files across, but I cant seem to find them on my development machine. Any ideas?

David Gardiner said...

yes, that is installed by SQL Server into your GAC. There are separate versions for SQL 2005 and 2008.

I guess the assumption is that you'll be running vsdbcmd on the same machine as your database. That was the case for me.

It should be possible to copy the file out of the GAC (or GAC_64) folder of the machine that does have SQL installed to where you're running vsdbcmd.


Thibaut DAVID said...

Thanks David your article helps me a lot for our deployment !

devmau5 said...

Thanks a lot David. This solved my issue with VSDBCMD. Really appreciate it.