ispiro
ispiro

Reputation: 27723

How to use UWP functionality from a .Net 6 WPF application?

I have a WPF application built for .Net Framework.

It references a UWP library for doing things like using Start-Tiles etc.

I'm now converting this WPF application to .Net 6, but can't seem to find a way to call UWP methods from it.

How can this be achieved?

Upvotes: 1

Views: 1357

Answers (1)

mm8
mm8

Reputation: 169400

An application that targets and runs on the .NET Framework cannot consume a library that is compiled for UWP, like for example a library that was created using the Class Library (Universal Windows) template in Visual Studio.

You may use Windows Runtime APIs in your .NET Framework app though but that's another thing.

If you want to share code between a .NET Framework application and a UWP app, your project that contains the shared code should target .NET Standard. It can then be consumed from all applications that target platforms that is compatible with the version of the .NET Standard you are targeting in your class library.

Upvotes: 2

Related Questions