更新的Visual Studio 2022预览到17.2.0 Preview 3来自2.1发行构建

发布于 2025-01-20 19:27:06 字数 1151 浏览 4 评论 0原文

在最新更新之前,我通常构建 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陪你到最终 2025-01-27 19:27:06

首先,您指定了两次这些行,另一条具有不同的版本编号:

<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.2" />

其次,这看起来像一个较旧的模板,也就是您已经从较早的预览开始了此项目。很好,但是对于每个更新,都可以仔细研究迁移您的项目以使用最新版本所需的内容。例如,这是 rc1 的注释。专门针对这些包装的包裹:

您的CSPROJ

不再需要这些

 &lt; itemgroup条件=“ $(targetframework.contains(' -  windows'))”&gt;
  &lt; packAgerference include =“ Microsoft.windowsappsdk”版本=“ 1.0.0” /&gt;
  &lt; packageReference包括=“ microsoft.graphics.win2d”版本=“ 1.0.0.30” /&gt;
&lt;/itemgroup&gt;
 

First, you specified these lines twice and one with different version numbers:

<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.2" />

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:

These are no longer needed in your csproj

<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
  <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
  <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
怪我鬧 2025-01-27 19:27:06

这对我有帮助:
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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文