Skip to content

Instantly share code, notes, and snippets.

@sangheestyle
Created November 14, 2018 12:40
Show Gist options
  • Save sangheestyle/619476c4f57e2e85021e884750f32681 to your computer and use it in GitHub Desktop.
Save sangheestyle/619476c4f57e2e85021e884750f32681 to your computer and use it in GitHub Desktop.
Creating PowerShell module from Mac

Creating PowerShell module from Mac

Requirement

Install up-to-date PowerShell Core.

$brew cask install powershell
...
$ pwsh --version
PowerShell v6.0.2
$

Install PSModule template.

dotnet new -i Microsoft.PowerShell.Standard.Module.Template

Create and install our PS module

dotnet new psmodule
dotnet build

The module is ready. Let's use it in pwsh.

pwsh
PS > Import-Module ./bin/Debug/netstandard2.0/PS.dll
PS > (Get-Module PS).ExportedCmdlets
PS > Test-SampleCmdlet(1)

Done.

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment