0
我試圖創建兩個PowerShell模塊之間的簡單依賴關係,但我得到的語法或東西錯了。如何在PowerShell模塊清單(psd1)中定義RequiredModules?
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"
}
)
}
我已經把文件多達上https://github.com/uli-weltersbach/PowerShellModuleQuestion爲好。
Module2
的模塊清單定義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.