我试图创建两个PowerShell模块之间的简单依赖关系,但是我在语法或其他方面出了问题。
Module1.psd1
:
@{
RootModule = 'Module1.psm1'
ModuleVersion = '1.0'
GUID = '11111111-1111-1111-1111-111111111111'
Author = 'uw'
FunctionsToExport = @()
CmdletsToExport = @()
VariablesToExport = '*'
AliasesToExport = @()
}
Module2.psd1
:
@{
RootModule = 'Module2.psm1'
ModuleVersion = '1.0'
GUID = '22222222-2222-2222-2222-222222222222'
Author = 'uw'
FunctionsToExport = @()
CmdletsToExport = @()
VariablesToExport = '*'
AliasesToExport = @()
RequiredModules = @(
@{
ModuleName = "Module1";
ModuleVersion = "1.0";
Guid = "11111111-1111-1111-1111-111111111111"
}
)
}
Module2
的模块清单定义了依赖于Module1
。
运行Test-ModuleManifest Module2.psd1
时,我遇到以下错误:
Test-ModuleManifest : The specified RequiredModules entry 'Module1' in the module manifest 'Module2.psd1' is invalid.
Try again after updating this entry with valid values.