更新的Visual Studio 2022预览到17.2.0 Preview 3来自2.1发行构建
在最新更新之前,我通常构建 Android 模拟器,不会出现任何问题。现在我得到这个错误: 错误 NETSDK1130 无法引用 Microsoft.Graphics.Canvas.winmd。当面向 .NET 5 或更高版本时,不支持直接引用 Windows 元数据组件。
我已确保所有 nuget 软件包都是最新的。 据我所知,C# 项目中的引用看起来很好:
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.2" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.0.7" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.0.7" />
<PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.0.7" />
</ItemGroup>
没有其他任何变化。有人有这个问题的解决方案吗?
I usually build to an android emulator without any issues until the latest update. Now I get this error:
Error NETSDK1130 Microsoft.Graphics.Canvas.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported.
I have made sure all nuget packages are fully up to date.
As far as I know references in the C# project look fine:
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.2" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.0.7" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.0.7" />
<PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.0.7" />
</ItemGroup>
Nothing else has changed. Anyone have a resolution to this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您指定了两次这些行,另一条具有不同的版本编号:
其次,这看起来像一个较旧的模板,也就是您已经从较早的预览开始了此项目。很好,但是对于每个更新,都可以仔细研究迁移您的项目以使用最新版本所需的内容。例如,这是 rc1 的注释。专门针对这些包装的包裹:
First, you specified these lines twice and one with different version numbers:
Second, this looks like an older template, aka you have started this project with an earlier preview. That is fine, but then for each update have a close look at what is needed to migrate your project to work with the latest version. For instance, here is the notes for RC1. Specifically for these packages it mentions:
这对我有帮助:
https://github.com/dotnet/maui/wiki/Migrating-to- RC1
自“迁移到Preview 13”以来,我经历了所有步骤以进行升级
This helps for me:
https://github.com/dotnet/maui/wiki/Migrating-to-RC1
I went through all steps for upgrading since "Migrate to Preview 13"