如何在 Visual Studio 中安裝 Win2D?

如何在 Visual Studio 中安裝 Win2D?

我正在嘗試在 Visual Studio 中安裝 Win2D。我在 nuget 套件管理器控制台中執行了以下命令:

PM> Install-Package Win2D

我收到以下錯誤:

Install-Package : Could not install package 'Win2D 0.0.10'. You are trying to install this package into a project that 
targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are 
compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Win2D
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

我今天剛安裝了 Visual Studio Community 2013,所以我應該使用最新版本。我究竟做錯了什麼?

答案1

事實恰恰相反。

您正在嘗試將此套件安裝到面向「.NETFramework,Version=v4.5」的專案中,但該套件不包含任何與該框架相容的組件參考或內容檔案。

這列出了兩個事實:

  1. 您的專案基於 .NET 4.5。
  2. 該軟體包(“Win2D 0.0.10”)與.NET 4.5不相容。

因此,您需要針對 .NET 的兼容版本或要求套件的作者支援它。

答案2

看來他們只針對 WinRT(地鐵/電話應用程式)。您將無法在常規桌面專案中使用它。

https://github.com/Microsoft/Win2D/issues/208

相關內容