あなたのコメントを読んだ後、私は次のようなものを提案します:
アプリケーションが削除されても、このデータベースは残ります。
アプリケーションを再インストールすると、残っていたデータベースを使用できます。
例:
namespace DBTest1 {
public partial class Form1 : Form {
const readonly string MYDATABASE = "\\Application Data\\DBTest1\\sqlce.db";
private void Form1() {
InitializeComponent();
CreateIfNotThere(DBTest1.Properties.Resources.sqlcedb, MYDATABASE);
}
void CreateIfNotThere(object data, string filename) {
if (String.IsNullOrEmpty(filename)) {
filename = string.Format(@"{0}{1}{2}",
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Path.DirectorySeparatorChar, "sqlCe.db");
}
if (data != null) {
byte[] array = (byte[])data;
FileInfo file = new FileInfo(filename);
if (!file.Exists) {
using (FileStream fs = file.Create()) {
fs.Write(array, 0, array.Length);
}
}
}
}
// other code
}
カスタム CABWIZ 手順の記述に取り掛かりたい場合は、コマンド ラインからスマート デバイス キャブ プロジェクトの inf ファイルを作成する方法に関する記事があります。スレッド。