DLL Not Found "libpsl-native" whilst attempting to create Powershell remote connection object (MAUI/BLAZOR/XAMARIN)

Karl McNally 1 Reputation point
2022-09-06T13:12:28.637+00:00

I wonder if anyone could help me with a problem I am experiencing in Visual Studio 2022 on the MAUI platform (although I have also tried Xamarin and Blazor platforms too).

When I attempt to create a powershell remote connection object I receive the error message on the native OS and Android devices.

InnerException {System.TypeInitializationException: The type initializer for 'System.Management.Automation.Tracing.PSSysLogProvider' threw an exception. ---> System.DllNotFoundException: libpsl-native at System.Management.Automation.Tracing.SysLogProvider..ctor(String app…} System.TypeInitializationException

The error is thrown from the second line of the following code:

WSManConnectionInfo connectionInfo = new WSManConnectionInfo();
connectionInfo.ComputerName = remoteMachine;

I have tried many, many different things to get passed this error message with absolutely no luck at all. I have installed git packages: "System.Management.Automation", "Microsoft.Powershell.SDK" and "Microsoft.Powershell.Native" and am able to reproduce this problem on both Visual Studio for Windows and Mac and across mutiple test projects I have created whilst troubleshooting this error.

I am starting to think this is a visual studio bug but would love to hear from other experienced developers who may have come across this or a similar issues in c# mobile development.

Thanks
Karl

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,631 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,911 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 26,551 Reputation points Microsoft Vendor
    2022-09-08T08:15:16.137+00:00

    Hello @Karl McNally ,

    Powershell is a Windows app and is not designed to connect to an Android or iOS Device for remote connections.
    The shell is not accessible on iOS, but Android can use ADB (Android Debug Bridge) to run shell commands. You won't have access to powershell commands, only commands that are available in Android's Linux implementation.
    Please see : PowerShell remoting - PowerShell | Microsoft Learn

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments