【问题标题】:Script error while nuget install of System.Data.Sqlitenuget 安装 System.Data.Sqlite 时出现脚本错误
【发布时间】:2015-12-11 08:44:10
【问题描述】:

重现步骤: 使用VS2012 Ultimate(我相信任何版本也可以)创建一个类库项目并右键单击引用并管理nuget包。使用 nuget 包管理器,尝试安装 System.Data.Sqlite(截至 10.21.2015 的最新版本)。

我收到以下错误消息:

Attempting to resolve dependency 'System.Data.SQLite.Core (≥ 1.0.98.1)'.
Attempting to resolve dependency 'System.Data.SQLite.Linq (≥ 1.0.98.1)'.
Attempting to resolve dependency 'System.Data.SQLite.EF6 (≥ 1.0.98.1)'.
Attempting to resolve dependency 'EntityFramework (≥ 6.0.0.0)'.
Installing 'System.Data.SQLite.Core 1.0.98.1'.
Successfully installed 'System.Data.SQLite.Core 1.0.98.1'.
Installing 'System.Data.SQLite.Linq 1.0.98.1'.
Successfully installed 'System.Data.SQLite.Linq 1.0.98.1'.
Installing 'EntityFramework 6.0.0'.
Successfully installed 'EntityFramework 6.0.0'.
Executing script file 'C:\Users\Thomas\Desktop\Active Projects\Contest\packages\EntityFramework.6.0.0\tools\init.ps1'.
Installing 'System.Data.SQLite.EF6 1.0.98.1'.
Successfully installed 'System.Data.SQLite.EF6 1.0.98.1'.
Installing 'System.Data.SQLite 1.0.98.1'.
Successfully installed 'System.Data.SQLite 1.0.98.1'.
Adding 'System.Data.SQLite.Core 1.0.98.1' to Contest.
Uninstalling 'System.Data.SQLite.Core 1.0.98.1'.
Successfully uninstalled 'System.Data.SQLite.Core 1.0.98.1'.
Install failed. Rolling back...
The result "" of evaluating the value "$(BuildTaskAssembly)" of the "AssemblyName" attribute in element <UsingTask> is not valid.  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFX.targets

当然,如果我只安装了“核心”包,它就可以工作。我不明白为什么我不能安装官方的“完整”包。

【问题讨论】:

  • 您的目标是哪个 .Net 版本?
  • 版本 4.5.2(插入额外字符)
  • 我在那里遇到了同样的问题,但没有具体说应该支持 4.5.2。奇怪的

标签: c# sqlite visual-studio-2012 nuget


【解决方案1】:

看这里。

http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

似乎没有 4.5.2 的正式版本

但是查看它指出的常见问题解答。 (http://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki#q3)

(3) What versions of .NET Framework are supported?

The .NET Framework 2.0 SP2 (or higher) for the System.Data.SQLite assembly.
The .NET Framework 3.5 SP1 (or higher) for the System.Data.SQLite.Linq assembly.
The .NET Framework 4.0 (or higher) for the System.Data.SQLite.EF6 assembly.
All sub-projects are fully supported with the .NET Framework 4.0.
All sub-projects are fully supported with the .NET Framework 4.5.

也许他们刚刚搞砸了,使用 4.5.1 或 4.5.0 有什么奇怪的?

------- 更新 1 -------

所以我决定做更多的挖掘改变 .net 并没有帮助我。手动安装它我得到了它的工作有点困难。

所以第 1 步 去这里获取其中一个版本。 http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki我拿到的是64位,4.5.1版本。

第 2 步安装 第 3 步打开 vs 并添加以下内容:(如果您没有更改安装设置,它们将是 C:\Program Files\System.Data.SQLite\2013\bin)

"SQLite.Designer.dll" 
"SQLite.Interop.dll" 
"System.Data.SQLite.dll" 
"System.Data.SQLite.EF6.dll" 
"System.Data.SQLite.Linq.dll" 

如果您对 SQLite.Interop.dll 感到不满,请参阅 Unable to load DLL 'SQLite.Interop.dll'

我只是手动将它复制到我的 bin 文件夹中。

然后我可以运行以下命令。

SQLiteConnection.CreateFile("MyDatabase.sqlite");

var m_dbConnection = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;");
m_dbConnection.Open();

string sql = "create table highscores (name varchar(20), score int)";

SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();

sql = "insert into highscores (name, score) values ('Me', 9001)";

command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();

m_dbConnection.Close();

我在这里找到的 Create SQLite Database and table

希望这会有所帮助:)。

Tldr 版本:金块看起来已经过时了。手动安装吧:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-23
    • 2015-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多