Can I use a 3rd party .NET API with Powershell?

Welcome Forums General PowerShell Q&A Can I use a 3rd party .NET API with Powershell?

This topic contains 4 replies, has 4 voices, and was last updated by

 
Participant
3 months, 2 weeks ago.

  • Author
    Posts
  • #132555

    Participant
    Points: 112
    Rank: Participant

    Hi all,

    Is it possible to use a 3rd party .net API designed for C# in Powershell?

    The API is for teamwork.com and is installed via a Nuget package in Visual Studio.

    Thanks for any help you can provide

  • #132563

    Participant
    Points: 411
    Helping Hand
    Rank: Contributor

    Hi Swatto – Yes, you can use, and usually the .Net classes will be initialised or referenced

    
    Add-Type -AssemblyName Namespace.Class
    or
    
    [Namespace.Class]::Method()
    
    or
    
    $Object = New-Object Namespace.Class # Parameter if any
    $Object.Property = {Get;Set;}
    $Object.Method()
    
    
  • #132594

    Participant
    Points: 112
    Rank: Participant

    Thanks very much Kiran.  I just need to figure out how to get the API without using the Visual Studio Nuget Package Manager.

  • #132603
    js

    Participant
    Points: 962
    Helping Hand
    Rank: Major Contributor

    Here's an example. Make sure the dll isn't blocked if it's from another computer.

    Add-Type -Path .\ServerCommandProxy.dll
    Add-Type -Path .\CookComputing.XmlRpcV2.dll
    
    $a = New-Object ServerCommandProxy($server,9191,$password)
  • #132626

    Participant
    Points: 380
    Helping Hand
    Rank: Contributor

    You can download nuget.exe if you want to grab packages outside of e.g. VS.

    https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools

The topic ‘Can I use a 3rd party .NET API with Powershell?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort