how to deploy .mdf file

喜夏-厌秋 提交于 2019-12-07 02:46:14

问题


I am trying to make an application, which uses a local .mdf database file (not attached to a sql server). Visual Studio says I have to install SQL Server Express before doing that. I was wondering how I can deploy the application to clients' box. Do they also need SQL Server Express installed?

Thanks a lot


回答1:


They need SQL Server Express installed. Once installed, you need to attach the database file (.mdf) to the server.




回答2:


Don't deploy MDFs. Have your application use deployment scripts and run the scripts that create the database, as well as scripts that create all the objects in the database. The issue with deploying a binary (an .MDF) is that you won't be able to upgrade it. Come v. 1.1 of your application, you'll face the dilema of how to deploy your new MDF, but preserver all the data your users saved in the old .MDF. This is not a trivial issue. Red Gate is trying to push its contiguous integration solution which uses diff tools to generate maintenance/upgrade scripts. Microsoft is pushing the Database Project which works similarly based on diff comparison done by the vsdbcmd tool. I'm not a fan of diff based tools, they are prone to making bad decisions, I much much more prefer explicit upgrade scripts.




回答3:


in solution explorer right click on your project

then on new item

then select Serviced based database

create a database and use it



来源:https://stackoverflow.com/questions/5795048/how-to-deploy-mdf-file

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