mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Merge pull request #1375 from PowerShell/cchen/bugfix
msft:8027609 Get-Module -List and Test-ModuleManifest import the the …
This commit is contained in:
@@ -652,7 +652,11 @@ namespace Microsoft.PowerShell.Commands
|
||||
else if (Directory.Exists(rootedPath))
|
||||
{
|
||||
// Load the latest valid version if it is a multi-version module directory
|
||||
foundModule = LoadUsingMultiVersionModuleBase(rootedPath, importModuleOptions, out found);
|
||||
foundModule = LoadUsingMultiVersionModuleBase(rootedPath,
|
||||
ManifestProcessingFlags.LoadElements |
|
||||
ManifestProcessingFlags.WriteErrors |
|
||||
ManifestProcessingFlags.NullOnFirstError,
|
||||
importModuleOptions, out found);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
string qualifiedPath = Path.Combine(path, fileBaseName);
|
||||
|
||||
// Load the latest valid version if it is a multi-version module directory
|
||||
module = LoadUsingMultiVersionModuleBase(qualifiedPath, options, out found);
|
||||
module = LoadUsingMultiVersionModuleBase(qualifiedPath, manifestProcessingFlags, options, out found);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
@@ -432,10 +432,11 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// Loads the latest valid version if moduleBase is a multi-versioned module directory
|
||||
/// </summary>
|
||||
/// <param name="moduleBase">module directory path</param>
|
||||
/// <param name="manifestProcessingFlags">The flag that indicate manifest processing option</param>
|
||||
/// <param name="importModuleOptions">The set of options that are used while importing a module</param>
|
||||
/// <param name="found">True if a module was found</param>
|
||||
/// <returns></returns>
|
||||
internal PSModuleInfo LoadUsingMultiVersionModuleBase(string moduleBase, ImportModuleOptions importModuleOptions, out bool found)
|
||||
internal PSModuleInfo LoadUsingMultiVersionModuleBase(string moduleBase, ManifestProcessingFlags manifestProcessingFlags, ImportModuleOptions importModuleOptions, out bool found)
|
||||
{
|
||||
PSModuleInfo foundModule = null;
|
||||
found = false;
|
||||
@@ -465,9 +466,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
null,
|
||||
this.BasePrefix, /*SessionState*/ null,
|
||||
importModuleOptions,
|
||||
ManifestProcessingFlags.LoadElements |
|
||||
ManifestProcessingFlags.WriteErrors |
|
||||
ManifestProcessingFlags.NullOnFirstError,
|
||||
manifestProcessingFlags,
|
||||
out found);
|
||||
if (found)
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
foreach (ModuleSpecification requiredModule in requiredModules)
|
||||
{
|
||||
var modules = GetModule(new[] { requiredModule.Name }, true, true);
|
||||
var modules = GetModule(new[] { requiredModule.Name }, false, true);
|
||||
if (modules.Count == 0)
|
||||
{
|
||||
string errorMsg = StringUtil.Format(Modules.InvalidRequiredModulesinModuleManifest, requiredModule.Name, filePath);
|
||||
|
||||
Reference in New Issue
Block a user