今天我花了相当长的时间使用 sql lite,发现 .net4 提供程序非常不稳定。所以我想我会使用SqlCE。它应该有一个零配置/安装,而不是最令人困惑的部署方式。
我检查了许多 SO 问题和这些文章:
链接
链接
更多更新的简短指南:
http:// /robindotnet.wordpress.com/2010/02/28/how-to-deploy-the-sqlserver-compact-edition-software-locally/
所以这是我的问题,没有 ;
标记位,它可以在我的 DEV 计算机上运行,但不能在没有 SqlCE 运行时的 XPSp3 上运行。它给了我一个
带有 > 的 FileIOLoadException
。标签它适用于 XpSp3,但在我的开发盒上它显示:
无法加载文件或程序集“System.Data.SqlServerCe,Version=3.5.1.50,Culture=neutral,PublicKeyToken=89845dcd8080cc91”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (HRESULT 异常:0x80131040)
我检查了这个回答但我很困惑。另外,显然 msdn 博客文章已关闭,您需要总共包含 7 个 dll。 System.Data.SqlServerCe.dll
和 System.Data.SqlServerCe.Entity.dll
均来自安装运行时的名为“Private”的文件夹。
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5"></remove>
<add name="Microsoft SQL Server Compact Data Provider"
invariant="System.Data.SqlServerCe.3.5"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
这个零配置到底是怎么回事!?我不知道到底出了什么问题,也不知道我做了什么来纠正它?除了一些旧博客之外,没有任何关于此的文档吗?
简单地说,一旦我需要部署,我只想能够复制 exe 和其他文件并且它应该可以工作。那么关于如何部署的参考/msdn/文档/逐步说明在哪里?
sqlce 也可以在仅安装了 .net4 的机器上运行,对吗?
So Ive spent quite some time today with sql lite and saw the .net4 providers were very un stable. So I figured I'll use SqlCE. Its supposed to have a zero config/install instead its the most confusing way to deploy the thing.
I check numerous SO questions and these articles:
Link
Link
A More updated short guide:
http://robindotnet.wordpress.com/2010/02/28/how-to-deploy-the-sqlserver-compact-edition-software-locally/
So here is my problem, without the <runtime>
tag bit, it WORKS on my DEV machine but NOT on XPSp3 without the SqlCE runtimes. It gives me a FileIOLoadException
WITH the <runtime
> tag it works on XpSp3 but on my dev box it says :
Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.1.50, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I checked this answer but Im VERY confused. Also, apparently the msdn blog articles are off, you need to include 7 dlls all together. And the System.Data.SqlServerCe.dll
and System.Data.SqlServerCe.Entity.dll
both come from folder named "Private" where the runtimes are installed.
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5"></remove>
<add name="Microsoft SQL Server Compact Data Provider"
invariant="System.Data.SqlServerCe.3.5"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
How in the world is this zero configuration!? I have no idea what really is going wrong nor what I did to make it right? Isn't there documentation on this anywhere Other than some old blogs?
Just simply put, once I need to deploy, I just want to be able to xcopy exe and other files and it should work.So where is the reference/msdn/documentation/step-by-step on how to deploy?
Also sqlce will work on a box with ONLY .net4 installed right?
发布评论
评论(2)
我在 6851346 中发布了一个非常类似的问题,我刚刚解决了它。
我不知道您是否仍在为此苦苦挣扎,但我在代码项目上找到了一个名为 为 SQL Compact 创建私有安装立即解决了我的问题。
我希望这对其他人也有帮助。
I had a very similar problem posted on S.O. in 6851346, and I just solved it.
I don't know if you are still struggling with this, but I found a solution on Code Project called Creating a Private Installation for SQL Compact that fixed my problems right up.
I hope this helps others, too.
你使用实体框架吗?如果不是,则不需要运行时标记。
您必须将其更改为:Version=3.5.1.0(在添加标记中)至 3.5.1.50,并确保使用 Private 文件夹中的 System.data.SqlServerCe.dll(它具有特殊的程序集版本)
Do you use Entity Framework? If not, the runtime tag is not required.
You must change this: Version=3.5.1.0 (in the add tag) to 3.5.1.50, and make sure you use the System.data.SqlServerCe.dll from the Private folder (it has this special assembly version)