Access a UWP class from WPF / .Net Framework project

Colm de Cleir 136 Reputation points
2022-12-08T11:24:24.8+00:00

I have a WPF application created with .Net Framework, however I need to use it to enable / disable the Windows 10 hotspot.

After much searching around, apparently the way to do it is using the NetworkOperatorTetheringManager class.

However, I can't use the Windows.Networking.NetworkOperators or add a reference, presumably because it's part of the UWP SDK and not the standard .NET framework. As I understand it, it would have to be built as a UWP application from the beginning.

Is there any way to do access this functionality?

(I've also come across WlanHostedNetworkStartUsing() but this appears to be for the now deprecated netsh hostednetwork rather than the Mobile Hotspot)

Universal Windows Platform (UWP)
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,681 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,310 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 81,831 Reputation points
    2022-12-08T11:34:05.147+00:00

    You must add References to

    C:\Program Files (x86)\Windows Kits\10\UnionMetadata\[version]\Windows.winmd
    and
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll

    Then you can add
    using RightNameSpace;
    and use the interface from the given namespace


0 additional answers

Sort by: Most helpful