今天想使用CodeSimth生成一個sqlite數據庫的模板。當添加添加數據庫的時候發現:
.Net Framework Data Provider 可能沒有安裝。
下面找到官方的文檔說明:
If you are trying to use the SQLite Schema Provider you may encounter the error message:'The System.Data.SQLite library is not installed on this computer'.This error can occur for two reasons:
CodeSmith Generator is compiled as AnyCPU. This means that Generator will run as a 64bit process when you launch Generator outside of Visual Studio. If you are generating from within Visual Studio (32bit process), then CodeSmith Generator libraries will run as a 32bit process.
The first step is to ensure that you download and install the latest .NET Framework 4.0 version of System.Data.SQLite.
IconIf you are running a 64bit version of windows, please install both the 32bit and 64bit versions.IconYou can skip the following configuration steps if you install the legacy version ofSystem.Data.SQLite here.The older version configures itself by adding entries into your machine.config.TheSQLite Schema Provider doesn't require a specific version of the SQLite managed libraries. This is because it usesDbProviderFactorieswhen interacting with SQLite. One must update all.NET Framework 4.0 machine.config's and add the SQLite provider to the DbProviderFactorieselement:
< system.data >
< DbProviderFactories >
< 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 > |
The .NET Framework 4.0 machine.config's can be found here:
看不懂的話,按照下面的方法做:
1、下載System.Data.SQLite驅動;注意:根據自己的CPU選擇是32位還是64位的驅動。建議選擇4.0平臺以上的。我的是:sqlite-netFx40-setup-bundle-x64-2010-1.0.91.0.exe;
2、安裝完成后打開C:/Program Files/System.Data.SQLite/2010/GAC把里面的兩個dll復制到CodeSimth安裝目錄下的bin文件夾;
3、配置
根據自己的CPU平臺打開下面路徑,【可能需要修改一下文件寫入的安全性,設置為Everyone就可以了,否則保存不了】
<
system.data
>節點添加下面的內容。
< system.data >
< DbProviderFactories >
< 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 > |
4、重啟CodeSimth就可以了。
新聞熱點
疑難解答