今天想使用CodeSimth生成一个sqlite数据库的模板。当添加添加数据库的时候发现:

.Net Framework Data Provider 可能没有安装。

下面找到官方的文档说明:

SQLite Schema 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:

  1. The System.Data.SQLite hasn't been installed on your machine.
  2. The System.Data.SQLite hasn't been properly configured.

Installing System.Data.SQLite

Icon

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.

This is very important to understand as it determines which Schema Provider dependencies are resolved at run-time.

The first step is to ensure that you download and install the latest .NET Framework 4.0 version of  System.Data.SQLite.

Icon

If you are running a 64bit version of windows, please install both the 32bit and 64bit versions.
Icon

You can skip the following configuration steps if you install the legacy version of System.Data.SQLite hereThe older version configures itself by adding entries into your machine.config. 

Configuring System.Data.SQLite

The SQLite Schema Provider doesn't require a specific version of the SQLite managed libraries. This is because it uses DbProviderFactories when interacting with SQLite. One must update all .NET Framework 4.0 machine.config's and add the SQLite provider to the DbProviderFactories element:

<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:

  • %windir%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
  • %windir%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
Next, you will need to copy the 64bit or 32bit SQLite assemblies that were installed via the System.Data.SQLite installer to CodeSmith Generators bin folder. This bin folder can be found in the location that you installed CodeSmith Generator to.
 

看不懂的话,按照下面的方法做:

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就可以了,否则保存不了】

  • %windir%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
  • %windir%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config (我选择的是这个)
  • 找到<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就可以了。

最新文章

  1. Python操作RabbitMQ
  2. install vim
  3. Android PullToRefresh (GridView 下拉刷新上拉加载)
  4. C语言 百炼成钢4
  5. ]用EnumChildWindows遍历窗口的方法
  6. WIN32和Kernel)直接读写硬盘扇区
  7. Nginx 独立图片服务器的搭建
  8. C++沉思录之一
  9. CentOS7配置Nodejs环境安装记录
  10. 关于Linux的常忘命令积累
  11. MySQL 死锁场景
  12. TypeError: Fetch argument 0.484375 has invalid type &lt;class &#39;numpy.float32&#39;&gt;, must be a string or Tensor. (Can not convert a float32 into a Tensor or Operation.)
  13. [luogu2286][宠物收养所]
  14. SNMP支持IPv6
  15. ironic驱动-IMPITool
  16. PDO数据库引擎
  17. 使用Webdriver刷博客文章评论
  18. tensorflow-作用域
  19. C++中的也能使用正则表达式----转载
  20. 【001】JS解析,反解析XML的一些问题

热门文章

  1. Angular2入门系列教程4-服务
  2. .NET 串口通信
  3. 浅谈 jQuery 核心架构设计
  4. Js 变量声明提升和函数声明提升
  5. 【小计】新人Tostring前忘记Null判断的处理
  6. Oracle数据库该如何着手优化一个SQL
  7. ASP.Net MVC4+Memcached+CodeFirst实现分布式缓存
  8. C++常见笔试面试要点以及常见问题
  9. css样式之超出隐藏
  10. Struts的文件上传下载