sql - Visual Studio 2010 Database Project Installer / Install script -
i have been using database project in visual studio 2010 create database. visual studio makes process easy deploy database , deploy updates. issue have how can visual studio create script build database can use on qa or production system.
i thought building project create sql file did not seem true. can please advise on how can or simple step missing.
as strange may sound, visual studio not create sql file deploy database when perform build.
instead, occurs @ deploy time. reason behind lies in way visual studio makes changes database you're deploying to: in order change database, must first compare project model (as defined in files contained within .dbproj) of existing database schema determine changes have made since database last deployed.
you have choice of manually executing sql script produced using sqlcmd command-line utility (or through ssms in sqlcmd mode), or alternately can configure visual studio database project execute script if specify following deploy action in project settings:
generate deploy script (.sql) , deploy database
note need provide connection string in project settings vs knows deploy to.
when stage want deploy qa or prod environment, have couple of options:
- deploy directly within visual studio. in addition standard debug , release configurations when first create database project, can create own configurations use deploy qa , prod environments (i.e. potentially different connection string/target database name).
- deploy build server. install visual studio on separate machine , call msbuild against .dbproj/.sln file build , deploy targets specified along appropriate connection properties.
doug rathbone has written great blog post on subject if want learn more: http://www.diaryofaninja.com/blog/2011/06/23/compare-amp-update-database-schemas-right-within-your-ide--part-2-automation-with-teamcity
Comments
Post a Comment