gpt4 book ai didi

c# - 不能同时使用 WP8.1 项目中引用的 System.IO.Compression 和 SQLite

转载 作者:太空宇宙 更新时间:2023-11-03 23:42:10 25 4
gpt4 key购买 nike

我的 Windows Phone 8.1 Silverlight 项目中出现奇怪的错误。我刚刚创建了一个小型测试项目并获得了相同的行为:

如果我安装"Microsoft.Bcl.Compression"

然后"SQLite.Net.Platform.WindowsPhone8"

通过 NuGet,如果我尝试压缩文件,即使我在任何行中根本没有使用 SQLite.NET,我也会收到以下异常。

在 entry.Open() 的以下代码中:

var entry = archive.CreateEntry(Path.GetFileName(file.Name));

using (var entryStream = entry.Open())

An exception of type 'System.IO.Compression.ZLibException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: The underlying compression routine could not be loaded correctly.

如果我从项目中删除 SQLite,那么压缩会按预期成功运行。

我使用了几个月没有问题的压缩,然后添加了 SQLite.NET 支持,现在以一个奇怪的异常结束。

我做错了什么吗?

小测试项目: CompressionAndSQLiteExample.zip

最佳答案

Microsoft.Bcl.Compression.targets 脚本存在问题,因为它使用与 sqlite-net-wp8 相同的目标名称 InjectReference。

我将 InjectReference 更改为 BCLCompressionInjectReference 并重新加载了项目,现在它工作正常。

关于c# - 不能同时使用 WP8.1 项目中引用的 System.IO.Compression 和 SQLite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28676295/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com