I have a PowerShell cmdlet written in C#. When I compile it, and pass it to Import-Module locally, it works fine. But, thus far, no combination of nuget pack has resulted in a package I can install from an Azure DevOps Artifact Gallery. I can pack and install script modules with ease, but not binary modules.
I have put all files in one base directory. I have put files into 'tools' directory. I have put the module dll in the base directory and the reference dlls in the 'lib' directory. Nothing works.
After examining several Microsoft cmdlets I found an answer.
In the *.psd1 there is a section for FunctionsToExport
but there is also a section for CmdletsToExport
and that's where you should list the binary cmdlets in this module.
The two key differences are: RootModule
is the dll name with prefix, and the cmdlets are listed under CmdletsToExport
.
There doesn't appear to be a need for a particular directory so you can use nuget.exe <snip> -Properties NoWarn=NU5100
to stop nuget.exe from warning you about the 'lib' directory.