PowerShell module packaging support for .NET SDK-style projects.
In use by a handful of modules.
- Support for script, binary, or mixed modules
- Module manifest templates with
{VersionPrefix}
,{VersionSuffix}
, and{Copyright}
placeholders - Run and debug with F5 in Visual Studio
- Support for automated build, test, and publish
Just add a reference to this package. Now dotnet pack
and Visual Studio Pack
will produce a PowerShell module. Here is a minimal example .csproj
file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Management.Automation"
Version="7.0.0" PrivateAssets="All" />
<PackageReference Include="Subatomix.Build.Packaging.PowerShellModule"
Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Content Include="$(PowerShellItemIncludes)"
Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
</Project>
For a simple example, see this repository's test project. It can serve as a template for new PowerShell module projects. For a more complete, real-world example with automated tests, see my PSql module.
Ready to automate build-and-publish to PowerShell Gallery? See this repository's GitHub Actions workflow for an example.