SOLVED

Import-Module dont import any command from my module

Brass Contributor

Hi,

I wrote a PSmodule foo.psm1, foo.psd1,

the .PSM1 contain some function used.

the PSD1 Config are shown below, the problem is when I run import-module foo, non of the function being imported and no command is available, the import was success, but commands are not available, I notice that the import-module -verbose is importing the .psd1 file not the psm1.

Did I miss anything.

 

The PSD1 contents are

#
# Module manifest for module 'foo'
#
# Generated by: Stinue Nizo
#
# Generated on: 8/1/2021
#

@{

# Script module or binary module file associated with this manifest.
# RootModule = 'foo.psm1'

# Version number of this module.
ModuleVersion = '1.0.1'

# ID used to uniquely identify this module
GUID = 'ecdefb1a-d0ee-469d-a48f-bec9b10b38cb'

# Author of this module
Author = 'Stinue Nizo'

# Company or vendor of this module
CompanyName = 'Stinue Nizo'

# Copyright statement for this module
Copyright = '2021'

# Description of the functionality provided by this module
Description = 'Testing module'

# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '5.1'

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @("Get-foo,Test-foo,Set-foo")

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'

}

 

 

2 Replies
best response confirmed by niazstinu (Brass Contributor)
Solution

Hello @niazstinu,

You did not specify Root module. Your line with RootModule = 'foo.psm1' is commented.

Hope that helps.

@AndySvints 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

I read the PSD1 line by line and I dont know how I miss this

not good to code for more than 24 hour :)

 

Thanks

 

1 best response

Accepted Solutions
best response confirmed by niazstinu (Brass Contributor)
Solution

Hello @niazstinu,

You did not specify Root module. Your line with RootModule = 'foo.psm1' is commented.

Hope that helps.

View solution in original post