Skip to content

NestedModules does not work on Linux if the path starts with '.' e.g. '.\folder\library.dll'  #3693

@hovsepm

Description

@hovsepm

Steps to reproduce

In psd1 have the following lines.
NestedModules = @('.\netstandard1.6\Microsoft.Azure.Commands.Profile.dll')
FormatsToProcess = '.\netstandard1.6\Microsoft.Azure.Commands.Profile.format.ps1xml'

Expected behavior

Both files could be found and loaded throug import-module

Actual behavior

ps1xml has no issues while Microsoft.Azure.Commands.Profile.dll file fails with obscure error message:

PS /usr/local/src> Import-Module AzureRM.Profile.Netcore -Verbose -Debug
VERBOSE: Loading module from path
'/opt/microsoft/powershell/6.0.0-alpha.18/Modules/AzureRM.Profile.Netcore/1.0.0/AzureRM.Profile.Netcore.psd1'.
VERBOSE: Loading 'FormatsToProcess' from path
'/opt/microsoft/powershell/6.0.0-alpha.18/Modules/AzureRM.Profile.Netcore/1.0.0/netstandard1.6/Microsoft.Azure.Commands.Profile
.format.ps1xml'.
VERBOSE: Populating RepositorySourceLocation property for module AzureRM.Profile.Netcore.
Import-Module : The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
At line:1 char:1

  • Import-Module AzureRM.Profile.Netcore -Verbose -Debug
  •   + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
      + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand 
    
    

Environment data

Red Hat Enterprise Linux 7

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.18
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Current Workaround

Remove '.' at the beginning of each NestedModule and everything works fine on Windows, Linux and Mac OS.
It is inconsistent and the worst thing is the error message.

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core module

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions