简体   繁体   English

VS2015-Nuget-软件包与UAP不兼容,版本= v10.0

[英]VS2015 - Nuget - Package incompatible with UAP,Version=v10.0

When I install SevenzipSharp.Net45 on my Windows 10 UWP app, I receive this message: 当我在Windows 10 UWP应用上安装SevenzipSharp.Net45时,收到以下消息:

Package SevenZipSharp.Net45 1.0.5 is not compatible with uap10.0 (UAP,Version=v10.0). 软件包SevenZipSharp.Net45 1.0.5与uap10.0(UAP,Version = v10.0)不兼容。 Package SevenZipSharp.Net45 1.0.5 supports: net45 (.NETFramework,Version=v4.5) One or more packages are incompatible with UAP,Version=v10.0. 软件包SevenZipSharp.Net45 1.0.5支持:net45(.NETFramework,Version = v4.5)一个或多个软件包与UAP不兼容,Version = v10.0。

This message is present also with other package I had make my UWP App with Framework 4.6 but I had tried also with 4.5 and the problem is the same? 此消息也存在于我使用Framework 4.6制作了UWP App的其他软件包中,但是我也尝试使用4.5进行过打包,问题是否相同?

Must I change something? 我必须改变一些东西吗? Thank's a lot. 非常感谢。

To extract 7Zip file in UWP, we can use SharpCompress . 要在UWP中提取7Zip文件,我们可以使用SharpCompress This package supports .NETStandard 1.3 so it can be used in UWP apps. 该软件包支持.NETStandard 1.3,因此可以在UWP应用中使用。 To use this library, we can install it from NuGet . 要使用此库,我们可以从NuGet安装它。

Install-Package sharpcompress 安装包sharpcompress

Please note to use this package, we also need to use at least 5.2.2 version of Microsoft.NETCore.UniversalWindowsPlatform for now. 请注意 ,使用此软件包之前,我们还需要至少使用5.2.2版本的Microsoft.NETCore.UniversalWindowsPlatform

And following is a simple sample. 以下是一个简单的示例。

using (var stream = await (await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"Assets\test.7z")).OpenStreamForReadAsync())
{
    using (var archive = SharpCompress.Archives.SevenZip.SevenZipArchive.Open(stream))
    {
        var entry = archive.Entries.First();
        using (var entryStream = entry.OpenEntryStream())
        {
            var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(entry.Key, CreationCollisionOption.OpenIfExists);
            using (var fileStream = await file.OpenStreamForWriteAsync())
            {
                entryStream.CopyTo(fileStream);
            }
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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