私はC#winforms、sqliteアプリケーションのセットアッププロジェクトを行っています。接続文字列は少し問題があるようです。ユーザーは、作業したいデータベースをある場所に配置します(vは彼に通知します)。この例では"C:\\Program Files(x86)\\DefaultCompany\\RSetup";
、ユーザーは自分のDBのコピーを操作できます。
そのため、Program.csMainでデータディレクトリをこのパスに設定しています。これが私が考えることができる唯一の方法です。より良い方法があればそれはgrt!!。
App.config
<add name="ConnString" connectionString="|DataDirectory|\MySQlite.db;Compress=True;Version=3"
providerName="System.Data.Sqlite" />
Program.cs
Setting the datadirectory to the path of the executable. Currently hard coded the path of the executable
static void Main()
{
AppDomain.CurrentDomain.SetData("DataDirectory","C:\\Program Files(x86)\\DefaultCompany\\RSetup");
これは機能していないようです。データが空白でない場合を除いて、エラーは発生しません。セットアップと通常のプロジェクトの両方で機能していないようです
ありがとうJC