从源代码构建System.Data.SQLite,并使用Target Framework 4.0进行构建 [英] Building System.Data.SQLite from Source, Builds with Target Framework 4.0

查看:37
本文介绍了从源代码构建System.Data.SQLite,并使用Target Framework 4.0进行构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用从

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

我能够构建解决方案,但是当我尝试从TargetFramework = 3.5的项目中引用System.Data.SQLite.dll时,收到以下消息:

I was able to build the solution, but when I tried to reference the System.Data.SQLite.dll from a project with TargetFramework=3.5, I received the following message:

"System.Data.SQLite.dll或其依赖项之一,需要更高版本.NET Framework版本而不是项目中指定的版本."

"System.Data.SQLite.dll or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project."

我注意到他们的托管项目(System.Data.SQLite.2010,System.Data.SQLite.Linq.2010和System.Data.SQLite.Module.2010)都设置为目标.NET 4.0.然后,我将它们全部更改为参考3.5,进行了重新构建,然后再次尝试.这样我就可以引用该项目,但是我收到一个新的运行时错误:

I noticed that their managed projects (System.Data.SQLite.2010, System.Data.SQLite.Linq.2010, and System.Data.SQLite.Module.2010) were all set to target .NET 4.0. I then changed all of them to reference 3.5, rebuilt, and tried again. I was then able to reference the project, however I receive a new runtime error:

无法覆盖文件或程序集'System.Data.SQLite'或其中之一依赖关系.该程序集由比当前已加载的运行时,无法加载."

"Could not oad file or assembly 'System.Data.SQLite' or one of its dependencies. This assembly is build by a runtime newer than the currently loaded runtime and cannot be loaded."

我使用ildasm打开.dll,清单确实显示了//元数据版本:v4.0.30319对我来说这没有意义,因为他们的文档明确指出它应该与.NET 2.0兼容:

I opened the .dll using ildasm , and the manifest indeed says // Metadata version: v4.0.30319 This doesn't make sense to me because their documentation clearly states that it should work with .NET 2.0:

".我们希望发布依赖于.NET Framework 2.0的托管二进制文件SP2(或用于LINQ程序集的.NET Framework 3.5 SP1).互联网Framework 2.0的部署非常广泛,因此可以生成二进制文件也可以从使用.NET的项目中成功引用和使用框架4.0."

".We want to ship managed binaries that rely on the .NET Framework 2.0 SP2 (or for the LINQ assembly, the .NET Framework 3.5 SP1). The .NET Framework 2.0 is very widely deployed and binaries produced for it can also be referenced and used successfully from projects using the .NET Framework 4.0. "

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

此解决方案是一场噩梦,其中包含大量目标文件和大量自定义生成选项.我不太确定在哪里设置目标框架.我认为某个地方发生了一些魔术.

This solution is kind of a nightmare, with lots of target files and tons of customized build options. I'm not quite certain where the target frameworks are being set. I assume there's some magic happening somewhere.

有人在构建此项目方面有任何经验吗?任何帮助,将不胜感激.谢谢!

Does anyone have any experience building this project? Any help would be appreciated. Thanks!

推荐答案

在Visual Studio 2010中针对v3.5构建System.Data.SQLite解决方案的关键是要知道VC ++项目(SQLite.Interop.2010和SQLite(.Interop.Static)默认情况下以框架版本4.0为目标.在将v3.5正确定位到C#项目(System.Data.SQLite.2010和System.Data.SQLite.Linq.2010)时,可能并不清楚如何为VC ++项目翻转目标版本.

The key to building the System.Data.SQLite solution in Visual Studio 2010 targeted at v3.5 is knowing that VC++ projects (SQLite.Interop.2010 and SQLite.Interop.Static) are targeted to framework version 4.0 by default. While you correctly targeted v3.5 on the C# projects (System.Data.SQLite.2010 and System.Data.SQLite.Linq.2010), it probably wasnt clear how to flip the targeted version for VC++ projects.

Microsoft建议的用于在VC ++中更改框架版本的方法是从Visual Studio 2010卸载项目.然后断开文本编辑器,在解决方案目录中找到.vcxproj,然后插入目标值为"的TargetFrameworkVersion标记.v3.5"添加到全局变量" PropertyGroup标记中.在Visual Studio 2010中重新加载项目后,现在应该在项目属性的框架和引用"部分中看到version = 3.5.参考链接

The suggested approach from Microsoft for changing framework versions in VC++ is to unload the project from Visual Studio 2010. Then break out a text editor, find your .vcxproj in the solution directory, and insert a TargetFrameworkVersion tag with a value of "v3.5" into the "Globals" PropertyGroup tag. After re-loading the project in Visual Studio 2010, you should now see version=3.5 in the Framework and References section of the project's properties. Reference Link

对于System.Data.SQLite,您必须对两个VC ++项目(SQLite.Interop.2010和SQLite.Interop.Static)都执行此操作.注意:如果您尝试将VC ++项目定位到Visual Studio 2010中的框架版本3.5,则还需要安装Visual Studio 2008 SP1(VC 9.0).此外,如果要在框架版本3.5的VC ++ 2010中针对x64进行编译,则需要在Visual Studio 2008 SP1(VC 9.0)中安装x64编译器和工具(默认情况下未安装).

For System.Data.SQLite, you'll have to do this operation for both VC++ projects (SQLite.Interop.2010 and SQLite.Interop.Static). NOTE: if you attempt to target VC++ projects to framework version 3.5 in Visual Studio 2010, you'll also need to have Visual Studio 2008 SP1 (VC 9.0) installed. Additonally, if you want to compile for x64 in VC++ 2010 on framework version 3.5, you'll need to have the x64 compiler and tools installed in Visual Studio 2008 SP1 (VC 9.0) (not installed by default).

重新编译后,ildasm在System.Data.SQLite.dll清单中应显示元数据版本:v2.0.50727"

After the recompile, ildasm should show "Metadata version: v2.0.50727" in the Manifest for System.Data.SQLite.dll

我确实注意到,在将VS2010解决方案切换到框架版本3.5之后,由于作者如何引用属性"资源(即Resources.resx),System.Data.SQLite.Linq.2010中出现了一些新的构建错误.在代码中.

I did notice that after flipping the VS2010 solution to framework version 3.5 that there were some new build errors in System.Data.SQLite.Linq.2010 due to how the author is referencing "Properties" resources (i.e. Resources.resx) in the code.

这篇关于从源代码构建System.Data.SQLite,并使用Target Framework 4.0进行构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆