不能同时使用 WP8.1 项目中引用的 System.IO.Compression 和 SQLite
Cannot use System.IO.Compression and SQLite both referenced in a WP8.1 project
我的 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 支持,现在出现了一个奇怪的异常。
我做错了什么吗?
Microsoft.Bcl.Compression.targets 脚本存在问题,因为它使用与 sqlite-net-wp8 相同的目标名称,InjectReference。
我将 InjectReference 更改为 BCLCompressionInjectReference 并重新加载了项目,现在它工作正常。
我的 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 支持,现在出现了一个奇怪的异常。
我做错了什么吗?
Microsoft.Bcl.Compression.targets 脚本存在问题,因为它使用与 sqlite-net-wp8 相同的目标名称,InjectReference。
我将 InjectReference 更改为 BCLCompressionInjectReference 并重新加载了项目,现在它工作正常。