Description
Steps to reproduce
Create a DSC configuration that imports a specific module version which happens to not be the newest one (at the time of writing the newest one for the module imported is 8.4.0.0):
# Cfg.ps1
configuration Cfg {
Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion '8.3.0.0'
}
Invoke PSScriptAnalyzer with SaveDscDependency switch:
Invoke-ScriptAnalyzer -SaveDscDependency -Path ./Cfg.ps1
It fails with Parse error in file ...: Cound not find the module '<xPSDesiredStateConfiguration, 8.3.0.0>'...
error.
Expected behavior
PSScriptAnalyzer should use the specified version of the module.
Actual behavior
PSScriptAnalyzer appears to only retrieve the newest version of the module. As soon as there's a newer version than specified available, the invocation breaks.
Environment data
This is with PSScriptAnalyzer version 1.17.1.
After looking at the implementation, I'm pretty sure that the module specification syntax doesn't work either: –ModuleName @{ModuleName="xPSDesiredStateConfiguration";ModuleVersion="8.3.0.0"}
.