文章来自:http://www.easyunity3d.com/sqlite-database.html
如何解决 Unity3D 引用 SQLite 数据库类不能发布可执行文件
今天工作时遇到的问题:
Unity3D Version: 3.5.6 f4
工程使用的是 SQLite 数据库,引用
using Mono.Data.Sqlite
项目工程不能发布可执行文件,进度条到一半的时候 console 提示错误:
ArgumentException: The Assembly System.Configuration is referenced by System.Data. But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch)
UnityEditor.HostView:OnGUI()
解决方法:
在 PlayerSettings 面板里面,找到对应发布平台,然后找到 Api ComCompatibility Level 下拉菜单,系统默认这一项是 “.NET 2.0 Subset”,但是这样设置就会导致而不能发布,改为 “.NET 2.0”然后再次发布,这次就成功生成 exe 文件。