You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Try to read the manifest with a streamreader just to ModuleVersion.
1017
+
# This makes a glaring but reasonable assumption that the moduleVersion is not dynamic and has no newlines.
1018
+
# Much more performant than a full parse, as it will stop as soon as it hits moduleversion, perhaps at the
1019
+
# expense of more iops due to the readline vs reading the entire file at once
1020
+
$reader= [IO.StreamReader]::new($manifestPath)
1021
+
[Version]$moduleManifestVersion=$null
1022
+
try {
1023
+
while ($null-ne ($line=$reader.ReadLine())) {
1024
+
if ($line-match'\s*ModuleVersion\s*=\s*[''"](?<version>.+?)[''"]') {
1025
+
$moduleManifestVersion=$matches['version']
1026
+
break
1027
+
}
1028
+
}
1029
+
} finally {
1030
+
$reader.Close()
1031
+
}
1032
+
1033
+
# Resolves an edge case where nuget packages are normalized in some package manages from 3.2.1.0 to 3.2.1
1034
+
if (-not$moduleManifestVersion) {
1035
+
Write-Warning"$($context.Module): Could not detect the module manifest version. This module may not install properly if it has trailing zeros in the version"
0 commit comments