How to use WASDK API outside of WASDK as a nuget package? #5197
-
I am trying to compile WASDK APIs outside of WASDK and use them in C# via projection. However I can't use the methods because I get an error that types don't exist Is this even possible? Or am I missing something? @DrusTheAxe @codendone
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
IAsyncOperation is part of the general WinRT API. This would mean that you need the Windows SDK projection referenced. This should happen automatically if you set the TFM to a Windows 10 version. Have you set the TFM? To clarify, this implicitly sets a reference to the Microsoft.Windows.SDK.NET.Ref package. |
Beta Was this translation helpful? Give feedback.
-
But "outside of WASDK" do you mean you're trying to use WASDK APIs at build-time without the WinAppSDK nuget? Or that you're trying to use WASK APIs at run-time without WASDK's MSIX packages? Are you aware of WADSK's "Self-Contained" option? Or are you trying to directly use WASDK's files yourself w/o WASDK's MSIX packages and without WASDK's nuget and support for WASDK/SelfContained? |
Beta Was this translation helpful? Give feedback.
If you are still having problems now, depending on how confident you are about modifying files, may I suggest that you just delete the current projection project and then create a new one? This may sound a bit weird, but sometimes Visual Studio does things that are problematic and cause major issues.
I had a look again at your project from the repository, and I get an almost constant error message:
What's more, Solution Explorer shows:
This means that the projection project is always being skipped. The application will never see the projection and therefore errors will occur.
The issue here is that the .sln file contains entries for the projection project that don't exist.