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)

Developer technologies Universal Windows Platform (UWP)
Developer technologies Windows Presentation Foundation
Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 90,521 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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.