Wednesday, September 15, 2010 8:06 AM
I'm new to the vsdbcmd tool, but after using it a couple times through the GUI in VS2010, I found that I can use this tool to create some upgrade scripts programmaticaly.
However, I've stumbled upon some errors when trying to compare a dbschema file to a dbproj...
I call the tool like this:
vsdbcmd.exe /a:Deploy /dd:- /dsp:sql /q:- /model:Adt.dbschema /targetmodel:Adt.dbproj /script:out.sql /p:TargetDatabaseName="Adt"
This throws the following errors:
*** FileFormatVersion attribute is missing or has unknown value.
*** TSD C:\xxxxx\Adt.dbschema (13581,7) The reference to external elements from the service named 'Server.dbschema' could not be resolved, because no such source is loaded.
I couldn't find much information about the first error, anybody here has an idea what this one means? I've checked the files for references to this 'FileFormatVersion', the Adt.dbschema has a line like this: (A similar line can be found in the Server.dbschema file.)
<DataSchemaModel FileFormatVersion="1.2" SchemaVersion="1.1" DspName="Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider" CollationLcid="1033" CollationCaseSensitive="False">
For the second error:
After some googling, some folks hinted that I should define the manifest file aswell, so I added the next parameter to the call:
However, this throws the same errors...
After some more googling, I found there were some fixes concerning the reference to external elements. But they are for VS2008.. So I'll assume this fix has been applied to VS2010?
My version of vsdbcmd.exe is 10.0.30319.1
Does anybody see what I do wrong here? Comparing these two files (and creating a SQL upgrade script) in the GUI of VS2010 works without any problems...
Thanks in advance
Thursday, September 16, 2010 7:03 AMModerator
Thanks for your post. For issue, I have some suggestions hopeful it helps you.
As far as I know the issue may be caused by comparing a dbschema file to a dbproj file. I think the better solution is to compare the build output of a dbschema with a database or another dbschema using vsdbcmd. Could you please compare a dbschema file with another dbschema file to have a try? If the same issue persists, please feel free to let me know.
Thanks and Best Regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help
Thursday, September 16, 2010 7:33 AM
Thanks for you reply.
When I'm comparing dbschema files with one another, it works. However, it does not create a upgrade script but a deployment script instead. (On one of the first lines it drops the entire database, so it can be recreate right after)
This is in line with the documentation on msdn though: http://msdn.microsoft.com/en-us/library/dd193250.aspx. You can't create an upgrade script when comparing just dbschema files. (You can, however, create an upgrade script by comparing a dbschema to a dbproject)
What I'm trying to achieve here is to create an automated versioning system. It would've been ideal to just compare the (previously saved) dbschema files of older versions with the latest version (the dbproject). Less ideal (but acceptable) could be that I compare these older versions with a deployed database (the developer's db), but I was trying to circumvent the need to deploy the db first.
(In any case, the developer will be required to validate the upgrade scripts manually, to make sure there will not be any loss of data)
I do find it odd that comparing a dbschema to a dbproject worked perfectly in the GUI in VS2010, but not through the command line... Do you have any idea why it didn't work in the command line utility?
Thursday, September 16, 2010 8:13 AMModerator
Make sure you are using the right VSDBCMD version. I found this problems in cases where customer didn´t use the VS2010 version for VS2010 dbschema deployments. Instead they were using VDSBCMD from 2008 which des not understand the fileformat of VS2010. I addition, the dbschema you want to deploy, with which versin of VS was it craeted. Does it come from a project that was upgraded from VS2008 (there used to be some issues in earlier versions of VS2010 products, but mainly CTP builds)
Jens K. Suessmeyer http://blogs.msdn.com/Jenss
Thursday, September 16, 2010 8:27 AM
All calls to the vsdbcmd happen on the developer's comp. Everything was build with VS2010, as there isn't even a VS2008 installed on this machine.
The database projects were also freshly created in VS2010 with .NET4, no upgrades happened.
Monday, September 20, 2010 9:04 AMModerator
Can you reproduce that on another machine as well ? If yes, would you mind sharing the project to see what is going on that causes the error ?
Jens K. Suessmeyer http://blogs.msdn.com/Jenss
Wednesday, September 22, 2010 9:27 AM
We've decided to not use this method and just let the developers create the upgrade scripts manually (They'd need to verify them anyway).
However, as I'm eager to find out what's wrong here, I'll try this on an other machine later today.
Friday, March 30, 2012 3:57 PM
Tom & Jens,
I was having this problem when I attempted to repackage VSDBCMD into a separate directory structure for deployment to a production environment. It turned out VSDBCMD needs the "Extensions" directory located in %PROGRAMFILES%\Microsoft Visual Studio 10.0\VSTSDB\Deploy. This isn't mentioned in the MSDN article that I'm aware of, or I missed it if it was.
I'm not sure if you were trying to package it up separately, but I had this exact error message and it was due to packaging it separately.