1

I created a Powershell module containing one Cmdlet implemented by C# and some advanced functions provided by a psm1 file. When loading the module, only the functions implemented in advanced functions are exported.

I registered the assembly to load as part of my module and exported the functions:

RequiredAssemblies = @("lib\provider.dll","lib\myCmdlet.dll")
FunctionsToExport = @('New-assemblyFunction','New-advancedFunction')

Also I tried to mix the above functionstoexport with the cmdlettoexport for the assembly provided Cmdlet. All kind of combinations did not show any success:

CmdletsToExport = @('New-assemblyFunction')

If I start the import-module in verbose mode, I can see that the assemblies are being loaded but only functions implemented in advanced functions are being exported. The New-assemblyFunction does not appear anywhere in the verbose report.

I can load the DLL manually (import-module) and the cmdlet is available. Any clue what's wrong here or how to further analyse? I deblock-file'd all of them.

3
  • 1
    Value of RequiredAssemblies key not considered as PowerShell modules. You need to use RootModule (ModuleToProcess) or NestedModules key. Commented Oct 28, 2016 at 23:00
  • That's it! Thank you! I added it as NestedModules and now the function has been exported. Commented Oct 29, 2016 at 7:57
  • Possible duplicate of PowerShell: Import-Module, but no "ExportedCommands" available Commented Feb 11, 2019 at 19:45

1 Answer 1

1

That's it:

Value of RequiredAssemblieskey not considered as PowerShell modules. You need to use RootModule (ModuleToProcess) or NestedModules key. – PetSerAl

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.