是否可以将Windows.Devices库添加到WinForm应用程序中?

时间:2018-10-09 08:42:41

标签: c# uwp

是否可以将通用Windows库添加到lib下面的c#Winform项目中?

using Windows.Devices

谢谢

1 个答案:

答案 0 :(得分:1)

您也可以在非UWP项目中手动引用UWP库。有关此问题的最新指南是in Microsoft Docs

简而言之-您需要引用winmdC:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5中合适的C:\Program Files (x86)\Windows Kits\10\库。

  • System.Runtime.WindowsRuntime -C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETCore \ v4.5
  • System.Runtime.WindowsRuntime.UI.Xaml -C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETCore \ v4.5
  • System.Runtime.InteropServices.WindowsRuntime -C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETCore \ v4.5
  • Windows.winmd -C:\ Program Files(x86)\ Windows Kits \ 10 \ UnionMetadata \ Facade
  • Windows.Foundation.UniversalApiContract.winmd -C:\ Program Files(x86)\ Windows Kits \ 10 \ References \ Windows.Foundation.UniversalApiContract
  • Windows.Foundation.FoundationContract.winmd -C:\ Program Files(x86)\ Windows Kits \ 10 \ References \ Windows.Foundation.FoundationContract