VSDB to SSDT Part 1 : Converting projects and trimming excess files

Posted by Etienne Giust on Geeks with Blogs See other posts from Geeks with Blogs or by Etienne Giust
Published on Wed, 12 Sep 2012 11:40:22 GMT Indexed on 2012/09/12 15:39 UTC
Read the original article Hit count: 358

Filed under:

Visual Studio 2012 introduces a change regarding Database Projects : they now use the SSDT technology, which means old VS2010 database projects (VSDB projects) need to be converted.

Hopefully, VS2012 does that for you and it is quite painless, but in my case some unnecessary artifacts from the old project were left in place.  Also, when reopening the solution, database projects appeared unconverted even if I had converted them in the previous session and saved the solution.

 

Converting the project(s)

When opening your Visual Studio 2010 solution with Visual Studio 2012, every standard project should be converted by default, but Visual Studio will ask you about your database projects :

“Functional changes required
Visual Studio will automatically make functional changes to the following projects in order to open them. The project behavior will change as a result. You will be able to open these projects in this version and Visual Studio 2010 SP1.”

If you accept, your project is converted. And it should compile with no errors right away except if you have dependencies to dbschema files which are no longer supported.

 

The output of a SSDT project is a dacpac file which replaces the dbschema file you were accustomed to. References to dacpac files can be added to SSDT projects in the same fashion references to dbschema could be added to VSDB projects.

 

Cleaning up

You will notice that your project file is now a sqlproj file but the old dbproj is still here. In fact at that point you can still reopen the solution in Visual Studio 2010 and everything should show up.

 

If like me you plan on using VS2012 exclusively, you can get rid of the following files which are still on your disk and in your source control :

  • the dbproj and dbproj.vspscc files
  • Properties/Database.sqlcmdvars
  • Properties/Database.sqldeployment
  • Properties/Database.sqlpermissions
  • Properties/Database.sqlsettings

 

You might wonder where the information which used to be in the Properties files is now stored.

  • Permissions : a Permissions.sql was created at the root level of your project. Note that when you create a new database project and import a database using the Schema Compare capabilities from Visual Studio, imported table and stored procedure definition files will hold the permission information (along with constraints and, indexes)
  • SQLVars : they are defined inside the publish.xml files
  • Deployment : they are also in the publish.xml files
  • Settings : I was unable to find where those are now. I suppose they are not defined anymore

 

But Visual Studio still says my database projects should be converted !

I had this error upon closing and then re-opening the solution : my database projects would appear unconverted even though I did all the necessary steps previously.

 

Easy solution : remove those projects from the solution and add them again (the sqlproj files).

 

More

For those who run into problems when converting from VSDB to SSDT, I suggest reading the following post : http://blogs.msdn.com/b/ssdt/archive/2011/11/21/top-vsdb-gt-ssdt-project-conversion-issues.aspx

 

Also interesting, is a side by side comparison of VSDB and SSDT project features :

http://blogs.msdn.com/b/ssdt/archive/2011/11/21/sql-server-data-tools-ctp4-vs-vs2010-database-projects.aspx

© Geeks with Blogs or respective owner