简体   繁体   English

如何使用MsBuild创建可移植数据库?

[英]How do you create portable databases with MsBuild?

I want to store in my solution a project containing the database creation scripts. 我想在我的解决方案中存储一个包含数据库创建脚本的项目。 When this project is built, it must generate a database file, which will then be used by this and other projects of the solution at the run time. 构建此项目时,它必须生成一个数据库文件,然后在运行时由此项目和解决方案的其他项目使用。 How to do that? 怎么做?

I know I can add Pre-Build task, but I wonder: 我知道我可以添加Pre-Build任务,但我想知道:

  • which command line can help me (maybe sqlite has a command line client?) 哪个命令行可以帮助我(也许sqlite有一个命令行客户端?)
  • will it need that I create an empty database file before running the scripts? 我需要在运行脚本之前创建一个空的数据库文件吗?

You can download the command line client shell for SQLite at http://www.sqlite.org/download.html 您可以在http://www.sqlite.org/download.html下载SQLite的命令行客户端shell

Then you can add the following Pre-Build task: 然后,您可以添加以下预构建任务:

"sqlite3.exe" %dbFilename% < Database.sql

尝试访问数据库(扩展名:accdb)...它易于编辑,可以备份和使用Office访问..以及它的便携式..

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

相关问题 如何使用MigratorDotNet向数据库添加索引? - How do you add indexes to databases with MigratorDotNet? 你如何维护多个版本的数据库? - How do you maintain multiple versions of Databases? MVC5 可移植区,你如何使用消息总线? - MVC5 Portable Area, how do you use message bus? 如何创建便携式应用(无需安装即可运行) - How do I create a portable app (runs without installing) 你如何将条件编译符号(DefineConstants)传递给msbuild - How do you pass conditional compilation symbols (DefineConstants) to msbuild 如何使用Linq连接不同数据库中的表? - How do you use Linq to connect tables in different databases? C#可移植类库 - 如何包含System.Data.Linq - C# Portable Class Library - How do you include System.Data.Linq 如何在可移植类库中为EF Core添加模式注释 - How do you add schema annotations for EF Core in a Portable Class Library 使用msbuild,如何在Csc Task Resources参数中指定可选的“ identifier”参数? - With msbuild how do you specify the optional 'identifier' argument in the Csc Task Resources parameter? 创建自定义MSBuild任务时如何从C#代码获取当前项目目录? - How do you get the current project directory from C# code when creating a custom MSBuild task?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM