File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -1651,6 +1651,18 @@ public static IEnumerable<string> GetModuleManifestKeys(Version powershellVersio
1651
1651
return keys ;
1652
1652
}
1653
1653
1654
+ public static IEnumerable < string > GetDeprecatedModuleManifestKeys ( )
1655
+ {
1656
+ return new List < string > { "ModuleToProcess" } ;
1657
+ }
1658
+
1659
+ public static bool IsModuleManifest ( string filepath )
1660
+ {
1661
+ // 4.0 and 3.0 contain the same keys. Hence, compare only with 4.0.
1662
+ return IsModuleManifest ( filepath , new Version ( "5.0" ) )
1663
+ || IsModuleManifest ( filepath , new Version ( "4.0" ) ) ;
1664
+ }
1665
+
1654
1666
public static bool IsModuleManifest ( string filepath , Version powershellVersion )
1655
1667
{
1656
1668
Token [ ] tokens ;
@@ -1676,8 +1688,8 @@ public static bool IsModuleManifest(string filepath, Version powershellVersion)
1676
1688
{
1677
1689
return false ;
1678
1690
}
1679
- var keys = GetModuleManifestKeys ( powershellVersion ) ;
1680
-
1691
+ var validKeys = GetModuleManifestKeys ( powershellVersion ) ;
1692
+ var allKeys = validKeys . Concat ( GetDeprecatedModuleManifestKeys ( ) ) ;
1681
1693
// check if all the keys in hast.keyvaluepairs are present in keys
1682
1694
int matchCount = 0 ;
1683
1695
foreach ( var pair in hast . KeyValuePairs )
@@ -1687,7 +1699,7 @@ public static bool IsModuleManifest(string filepath, Version powershellVersion)
1687
1699
{
1688
1700
break ;
1689
1701
}
1690
- foreach ( var key in keys )
1702
+ foreach ( var key in allKeys )
1691
1703
{
1692
1704
if ( key . Equals ( pairKey . Value , StringComparison . OrdinalIgnoreCase ) )
1693
1705
{
You can’t perform that action at this time.
0 commit comments