-1

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.

mklement0
  • 382,024
  • 64
  • 607
  • 775
Tom Padilla
  • 924
  • 10
  • 30
  • Before you post, summarize the problem and provide details and example for that to describe what you’ve tried. – Hakimeh Mordadi Jul 28 '20 at 20:29
  • I can't state any simpler: the module doesn't work when I use Install-Module from an Azure DevOps Artifact Gallery. There are no details - it simply doesn't work. The details are "nothing". Nothing comes out on the screen, the Auto-Complete doesn't work, the moduile isn't identified...Nothing. I listed what I tried. What example would you like? It's a list of dlls in a directory. Do you want me to add the dlls to the question? I'm not sure what you could be asking for. Maybe this shows my lack of expertise in this area: I don't even know what I said wrong. – Tom Padilla Jul 28 '20 at 22:24

1 Answers1

0

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.

Tom Padilla
  • 924
  • 10
  • 30