I need to deploy SQLite file with WPF application.
- Deployment technique is ClickOnce.
- Entity Framework is included to work with the database.
I'd like to have a shortlist what must be considered when deploying the application that includes a SQLite database file in it.
So far, I have referenced and set Copy Local to True for:
- System.Data.SQLite
- System.Data.SQLite.Linq
.and I have two interops where Copy to Output Directory I left to be the default Copy Always
- SQLite.Interop.dll (x86)
- SQLite.Interop.dll (x64)
In the app.config file I have:
<applicationSettings>
<MyApp.MySettings>
<setting name="connStrSQLite" serializeAs="String">
<value>data source="C:\MyFolder\MySQLiteFile.sqlite3"</value>
</setting>
</MyApp.MySettings>
</applicationSettings>
and
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/Model.ORM.MyModel.csdl|res://*/Model.ORM.MyModel.ssdl|res://*/Model.ORM.MyModel.msl;provider=System.Data.SQLite;provider connection string='data source="C:\MyFolder\MySQLiteFile.sqlite3"'" providerName="System.Data.EntityClient" />
</connectionStrings>
I suppose in the app.config the paths are not working on deployed application since they are referring to my local folder now. How to modify them?
Then, I checked for example from here SQLite deployment for .net application that the following should be added to app.config file.
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
Anything else?