Skip to main content

load_solution

Load a .sln/.slnx solution at runtime and make it the active solution. Both include and rootProjects match against the project FILE NAME without extension (the .csproj/.vbproj base name), NOT the assembly name. Pass include (case-insensitive glob array, supporting only * and ? wildcards — character classes like [...] are NOT supported) or rootProjects (EXACT, case-sensitive file names) to load only a subset; the loader walks ProjectReference transitively from those seeds to keep the workspace semantically complete. A filter that matches NO project is an ERROR (the call fails) — it does NOT silently fall back to a full load; if unsure of exact names, do a no-filter load first and call list_solutions to discover them. If the same path is already loaded, providing a new filter disposes the previous workspace (replace semantics). If the solution is already loaded with no filter, it simply activates it (~instant). New solutions take ~3 seconds to load and compile. For very large solutions (hundreds of projects) that take minutes to open, pass background: true to return a taskId immediately instead of blocking; poll it with get_task_status until it succeeds (its result carries the loaded/skipped counts). The new solution only becomes active once the background load finishes, so other tools keep working against the current solution meanwhile.

Parameters

ParameterTypeRequiredDescription
pathstringFull path to the .sln or .slnx file to load
includeString[]Optional case-insensitive glob patterns against project file name without extension (e.g. 'MyApp.*')
rootProjectsString[]Optional exact project file names without extension; both arrays act as seeds for a transitive ProjectReference closure
backgroundboolIf true, load on a background task and return a taskId immediately (poll with get_task_status) instead of blocking until the solution is ready. Default false.