简体   繁体   English

Azure.Storage.Files.Shares 不会使用.Net 7 安装在.Net MAUI 上

[英]Azure.Storage.Files.Shares wont install on .Net MAUI using .Net 7

When trying to install Azure.Storage.Files.Shares on a empty .NET MAUI app (created directly from the VS 2022 17.4.4 wizard) I get a series off incompatibilities.当尝试在空的 .NET MAUI 应用程序(直接从 VS 2022 17.4.4 向导创建)上安装 Azure.Storage.Files.Shares 时,我遇到了一系列不兼容问题。 If have tried a simple Console app and the problem is the same.如果尝试了一个简单的控制台应用程序并且问题是相同的。

  • Restoring packages for C:\Users\brend\source\repos\MauiApp7\MauiApp7\MauiApp7.csproj...正在恢复 C:\Users\brend\source\repos\MauiApp7\MauiApp7\MauiApp7.csproj...
  • NU1202: Package Azure.Storage.Files.Shares 12.12.1 is not compatible with.net7.0-android33.0 (.NETCoreApp,Version=v7.0). NU1202:Package Azure.Storage.Files.Shares 12.12.1 与.net7.0-android33.0 (.NETCoreApp,Version=v7.0) 不兼容。 Package Azure.Storage.Files.Shares 12.12.1 does not support any target frameworks. Package Azure.Storage.Files.Shares 12.12.1 不支持任何目标框架。
  • NU1202: Package Azure.Storage.Common 12.13.0 is not compatible with.net7.0-android33.0 (.NETCoreApp,Version=v7.0). NU1202:Package Azure.Storage.Common 12.13.0 与.net7.0-android33.0 (.NETCoreApp,Version=v7.0) 不兼容。 Package Azure.Storage.Common 12.13.0 does not support any target frameworks. Package Azure.Storage.Common 12.13.0 不支持任何目标框架。
  • NU1202: Package System.Text.Json 4.7.2 is not compatible with.net7.0-android33.0 (.NETCoreApp,Version=v7.0). NU1202:Package System.Text.Json 4.7.2 与.net7.0-android33.0 (.NETCoreApp,Version=v7.0) 不兼容。 Package System.Text.Json 4.7.2 does not support any target frameworks. Package System.Text.Json 4.7.2 不支持任何目标框架。
  • NU

Any ideas what I am missing?有什么想法我想念的吗?

I expected the Nuget package to install, just like the demos in the Microsoft examples我希望安装 Nuget package,就像 Microsoft 示例中的演示一样

I don't think the package Azure.Storage.Files.Shares is available for MAUI.我认为 package Azure.Storage.Files.Shares用于 MAUI。

You can check the dependencies section of the nuget package here .您可以在此处查看nuget package 的依赖项部分。 The only target it supports is .NETStandard 2.0它支持的唯一目标是.NETStandard 2.0

[.NETStandard 2.0]
Azure.Storage.Common (>= 12.13.0)
System.Text.Json (>= 4.7.2)

Compare it with, for example the package which supports MAUI like ZXing library which has the required target .net7.0-android33.0将其与支持 MAUI 的 package 进行比较,例如具有所需目标.net7.0-android33.0 ZXing 库

[net7.0-android33.0]
Xamarin.AndroidX.Camera.Camera2 (>= 1.1.0)
Xamarin.AndroidX.Camera.Lifecycle (>= 1.1.0)
Xamarin.AndroidX.Camera.View (>= 1.1.0)
ZXing.Net (>= 0.16.8)

Edit编辑

As @ewerspej pointed out, the library indeed has net7.0-android target if we look in framwework section on nuget package site.正如@ewerspej 所指出的,如果我们查看 nuget package 站点上的 framwework 部分,该库确实具有net7.0-android目标。 I tested out by creating new MAUI project with net7.0-android as target framework and also by changing to specific net7.0-android33.0 as well in .csproj file, I was able to install the package correctly in both the cases!我通过使用net7.0-android作为目标框架创建新的 MAUI 项目并在.csproj文件中更改为特定net7.0-android33.0了测试,我能够在这两种情况下正确安装 package!

I did discover that the Nuget cache must have been corrupted in some way.我确实发现 Nuget 缓存一定以某种方式损坏了。 I did try to clear the cache using the tools in VS 2022, however an error occurred.我确实尝试使用 VS 2022 中的工具清除缓存,但是出现错误。 After reinstalling Visual Studio I was able to use the Azure.Storage.Files.Shares package.重新安装 Visual Studio 后,我可以使用 Azure.Storage.Files.Shares package。

As pointed out in one of replies.net7.0-android and.net7.0-android33.0 had something to do with the problem, but I was not able to isolate it.正如其中一个回复所指出的那样,.net7.0-android 和 .net7.0-android33.0 与问题有关,但我无法将其隔离。

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

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