Closed
Description
When trying to build on a system with PowerShell Version 3 there are several build errors. There are several methods that are referencing types in the new V5 System.Management.Automation DLL. Adding several additional conditional compilation directives allows this to be successfully built on a machine with PowerShell Version 3.
- Solution configurations should be updated so all projects build with the appropriate PSV3 build configuration. The ScriptAnalyzerBuiltinRules project is not set to the appropriate PSV3 configuration.
- Several methods reference types only available in the updated System.Management.Automation DLL.
Engine/VariableAnalysisBase.cs
- Add conditional compilation directive (#if !PSV3) around
internal static TypeDefinitionAst FindClass(Ast ast, string name)
method - Add conditional compilation directive (#if !PSV3) around
internal static TypeDefinitionAst FindClassAncestor(Ast ast)
method
Engine/Helper.cs
- The Configuration value does not exist in the PSV3 version of the CommandTypes enum. Adjust method signature with conditional compilation directive to remove the unsupported enumeration value.
public CommandInfo GetCommandInfo(string name, CommandTypes commandType = CommandTypes.Alias | CommandTypes.Cmdlet | CommandTypes.Configuration | CommandTypes.ExternalScript | CommandTypes.Filter | CommandTypes.Function | CommandTypes.Script | CommandTypes.Workflow)
- Add conditional compilation directive (#if !PSV3) around
internal List<RuleSuppression> GetSuppressionsClass(TypeDefinitionAst typeAst)
method