I'd like export an alias from a binary module that I've created. For script modules, you'd use
Export-ModuleMember. Is there an equivalent for binary modules?
My manifest (.psd1) looks something like this:
@{
ModuleToProcess = 'MyModule.psm1'
NestedModules = 'MyModule.dll'
ModuleVersion = '1.0'
GUID = 'bb0ae680-5c5f-414c-961a-dce366144546'
Author = 'Me'
CompanyName = 'ACME'
Copyright = '© ACME'
}
EDIT: Keith Hill provided some help, but still to no avail. Here are all the files involved
My module script (.psm1):
export-modulemember -function Get-TestCommand -alias gtc
and finally, the code in my DLL:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading.Tasks;
namespace MyModule
{
[Cmdlet(VerbsCommon.Get, "TestCommand")]
[OutputType(typeof(string))]
public class GetTestCommand : PSCmdlet
{
protected override void ProcessRecord()
{
WriteObject("One");
WriteObject("Two");
WriteObject("Three");
}
}
}
If I have this and fire up PowerShell, then import-module MyModule and finally run get-module, I get this:
ModuleType Name ExportedCommands
---------- ---- ----------------
Script MyModule {}
If I comment out the export-modulemember bit in the psm1 file and repeat the above steps, I get this:
ModuleType Name ExportedCommands
---------- ---- ----------------
Script MyModule Get-TestCommand
So, what am I doing wrong here?
Get-Module MyModule | Foreach {$_.ExportedAliases}or simplygmo MyModule | fl. - Keith Hill