简体   繁体   中英

ambiguous reference: SharpCompress and BouncyCastle for C#

I'm using BouncyCastle for C# in my Windows 8 / Windows Phone 8 app. Recently I had to include SharpCompression for Windows / Windows Phone 8, but now app can't be build due to ambiguous references to classes inside Org.BouncyCastle.Crypto.

I've found that SharpCompression lib also includes Org.BouncyCastle.Crypto in its dll.

Is there any way to build in current state (some pragmas or something)? Maybe there is another library to support zlib compression? I need Any CPU, ARM, x86 dlls (or universal) because code base is shared between Windows Store and Windows Phone 8 projects.

I tried but can't compile neither BouncyCastle nor SharpCompression myself (thought to rename some namespaces). Maybe there are compilable versions of them?

Actually it is a brilliant example of using aliases in reference properties.

Right-click on SharpCompress reference, Properties, Alias - change gloabal to for example "sc".

Then in code:

extern alias sc;
using sc.SharpCompress.Compressor;
using sc.SharpCompress.Compressor.Deflate;

And everithing is build! Because now there are two namespaces: Org.BouncyCastle.Crypto and sc.Org.BouncyCastle.Crypto.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM