Deploying VS2010 Database Projects Without VSDBCMD?

别说谁变了你拦得住时间么 提交于 2019-12-23 16:10:37

问题


We have been using Visual Studio 2010's database projects for several internal or single-customer projects since they were first introduced, and they are working great for us so far. Now we're using them for the first time with a "boxed" product that needs to be packaged for installation at arbitrary customer sites.

Everything I have seen so far suggests that I ship the .dbschema file plus the vsdbcmd tool and its requirements as part of my MSI, then launch that tool as part of the install.

Is this really the simplest way to accomplish this task? We are doing this for our initial beta testing but so far, it seems like a quick hack rather than a good long-term deployment strategy. In particular, we are forced to install both SQL Server CE 32-bit and SQL Server CE 64-bit onto the machine before installing our software. Every attempt to package what we needed just within the MSI failed because we were missing an assembly from one or the other architecture.

The other thing we looked into was shipping the output sqlcmd files that are produced when we "deploy" the project at build time, but those include the hard-coded server name of our internal development server (and its not a SQLCMD variable like the database name is), meaning we had to edit the .sql script during the server install. Again, that works but it seems like a bad idea in general.

Our final approach, and what we will likely end up doing for production if I can't come up with something beter, is to produce create and upgrade scripts manually, based on the deployment outputs, then include a custom tool with our installer that executes the scripts (through SqlClient or sqlcmd or something similar) based on user interaction, but this seems to be defeating much of the purpose of the Database Projects.

Are there any other ways to build and package a VS2010 DB project for automated deployment, to different servers, that doesn't involve installing 2 versions of SQL CE and shipping a piece of Visual Studio with our installer?


回答1:


As far as I know, what you have suggested initially is probably best.

Microsoft appears to have known this from the beginning, since they recommend and have instructions on how to install vsdbcmd on build servers without needing Visual Studio. You could easily extend this thinking, to installing on a Customers site.

While you could come up with your own method of creating the output files and doing some post build process on them, you've just moved the complexity somewhere else and created another bit of code that needs maintaining.

The installers for SQL CE aren't that big and making it part of your MSI keeps things simple, packaged together and ensures you get the maximum functionality out of the database projects.

I answered a similar question to this and link to a relevant MS article, in this SO question:
Can I do database deployments, without installing Visual Studio or VSTSDB?



来源:https://stackoverflow.com/questions/10435739/deploying-vs2010-database-projects-without-vsdbcmd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!