Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Import-Module not working if psd1 and module folder has different casing (on unix) #17342

Copy link
Copy link
@4ndri

Description

@4ndri
Issue body actions

Prerequisites

Steps to reproduce

  • open powershell on linux
  • import a module, where casing of the psd1 file is different to the casing of the module folder.
    run the following script for repro:
$modulesPath= "$(Get-Location)/modules/";
$env:PSModulePath += [System.IO.Path]::PathSeparator + $modulesPath
$moduleName = "testmodule";
New-Item -ItemType Directory -Path "$modulesPath/$moduleName" -Force > $null
New-ModuleManifest -Path "$modulesPath/$moduleName/$($moduleName.ToUpper()).psd1" -RootModule "TestModule.psm1" -ModuleVersion 1.1
Set-Content -Path "$modulesPath/$moduleName/TestModule.psm1" -Value "function mytest { 'hello' }"
Import-Module testmodule

Expected behavior

module names should be case insensitive. the module should load.

Actual behavior

Error: The specified module 'testmodule' was not loaded because no valid module file was found in any module directory.

Error details

Exception : 
    Type    : System.IO.FileNotFoundException
    Message : The specified module 'testmodule' was not loaded because no valid module file was found in any module directory.
    HResult : -2147024894

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.3
PSEdition                      Core
GitCommitId                    7.2.3
OS                             Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.