LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 3 years have passed since last update.

UWPのAPIをWPFで使えるようにする

Last updated at Posted at 2019-02-27

UWPのAPIをWPFで使えるようにする

やり方1(これで動いた)

下記を参照に追加
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd

下記を参照に追加
(非同期メソッドを呼ぶため)
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll

参考:
かずきブログ
https://blog.okazuki.jp/entry/2018/03/29/101601
msドキュメント
https://blogs.msdn.microsoft.com/appconsult/2016/10/31/desktop-bridge-expanding-a-desktop-application-with-the-uwp-apis/
サポートされてるAPI
https://docs.microsoft.com/ja-jp/windows/uwp/porting/desktop-to-uwp-supported-api

やり方2(両方で定義されています、というエラーが出る?)

ここを見る。

image.png

winmdについては、
ローカルにコピーをfalseにするのを忘れない。

やり方3

nugetでMicrosoft.Windows.SDK.Contractsを追加する
https://qiita.com/FumiyaHr/items/13de3dcbd9b81d9d27f0#nuget%E3%81%A7%E8%BF%BD%E5%8A%A0

0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up