Menu

1 / 2

How PSScriptBuilder Analyzes PowerShell Dependencies — and What Happens When They Form a Cycle

DEV Community·Tim Hartling·6 months ago
#461tvvig
Reading 0:00
15s threshold

If you've read the first article in this series , you already know that PSScriptBuilder resolves PowerShell class load order automatically. This article goes one level deeper: what exactly does PSScriptBuilder analyze, how does it build a dependency graph, and what happens when that graph contains a cycle?

What PSScriptBuilder Extracts

When PSScriptBuilder processes your source files, it runs AST analysis on every collected component and extracts the following dependency information:

Component Dependencies extracted

Class Base class, type references (properties, method parameters), static initializer references, called functions

Function Called functions, type references

Enum None — enums have no outgoing dependencies and always appear first

Built-in types ( string , int , bool , System.* , etc.) are automatically excluded — only types that are part of your project create graph edges.

The Dependency Graph

The extracted dependencies form a directed graph where each node is a component and each edge…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.