简体   繁体   English

VS2010如何在安装程序中打包DB文件

[英]How VS2010 packs DB files in installer

question: 题:

I am working on, Visual Studio 2010 Premium, I know that there is no possibility to add Local Database. 我正在研究Visual Studio 2010 Premium,我知道无法添加本地数据库。 For this reason, database is added through Server Explorer > Add Connections. 因此,通过服务器资源管理器>添加连接来添加数据库。

And my DB file is saved in: C:\\Program Files\\Micrisoft SQL Server\\MSSQL10.SQLEXPRESS\\MSSQL\\DATA\\ContactDB.mdf 我的数据库文件保存在:C:\\ Program Files \\ Micrisoft SQL Server \\ MSSQL10.SQLEXPRESS \\ MSSQL \\ DATA \\ ContactDB.mdf

How it will compile when it is necessary to make installer of application. 当需要制作应用程序的安装程序时,它将如何编译。 If VS compile all in 1 package - source codes and DB files? 如果VS编译全部为1包-源代码和DB文件? What best practices for this when making Installer of App - if database is added through Server Explorer > Add Connnections. 制作应用安装程序时的最佳做法-如果通过服务器资源管理器>添加连接添加了数据库。

With regards! 带着敬意!

Well as far as I know mdf file is added to your project. 据我所知,mdf文件已添加到您的项目中。 If it is not added check the mdf file property Copy to output Directory . 如果未添加,请检查mdf文件属性Copy to output Directory This needs to be set Copy Always to ensure your mdf file is being copied to output folder. 这需要设置为Copy Always以确保将您的mdf文件复制到输出文件夹。

Here is an another approach to deploying an application with database. 这是使用数据库部署应用程序的另一种方法。

Deploy your Application and Database 部署您的应用程序和数据库

Also you can use scripts to create your database from scratch while deploying your application. 您也可以在部署应用程序时使用脚本从头开始创建数据库。 Check this msdn article 检查这篇msdn文章

Specify Pre-Deployment or Post-Deployment Scripts 指定部署前或部署后脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM