-
Notifications
You must be signed in to change notification settings - Fork 123
Configuring CSharpRepl
C# REPL is configured with command-line options. The same options can be saved to a config file or a response file so they apply to every session.
csharprepl [OPTIONS] [@response-file.rsp] [script-file.csx] [-- <script-arguments>]-
[OPTIONS]: any of the options below. -
[@response-file.rsp]: a file of options, one per line. -
[script-file.csx]: a C# script run before the prompt starts. -
<script-arguments>: forwarded to the script and available in a globalargsvariable.
Run csharprepl --help to see the options along with your installed frameworks and themes.
-
-r,--reference <dll>: reference an assembly, NuGet package, or csproj. Repeatable. -
-u,--using <namespace>: add a using statement. Repeatable. -
-f,--framework <framework>: reference a shared framework. Common values:Microsoft.NETCore.App(default),Microsoft.AspNetCore.App,Microsoft.WindowsDesktop.App. -
--usePrereleaseNugets: consider prerelease versions when resolving the latest NuGet package.
-
-t,--theme <theme.json>: syntax highlighting theme. See Themes and Colors. -
--useTerminalPaletteTheme: use your terminal's palette instead of a theme file. -
--prompt <markup>: set the prompt string. -
--useUnicode: enable UTF-8 output and unicode decorations (needs terminal support). -
--tabSize <width>: width of a tab character. -
--culture <name>: culture used for MSDN documentation links. Defaults to the current culture.
-
-e,--eval <code>: run code, print the result, and exit. Mutually exclusive with--eval-file. -
--eval-file <path>: run a.csxor.csfile, print the result, and exit. -
--streamPipedInput: when input is piped through stdin, evaluate it line by line instead of as one batch.
See AI Completions for the provider list and setup.
-
--aiProvider <name>: provider preset (openaidefault, alsoanthropic,gemini,grok,deepseek,mistral,codestral). -
--aiApiKey <key>: API key (overrides the provider's environment variable). -
--aiEndpoint <url>: base URL of an OpenAI-compatible API (overrides the provider's default endpoint). -
--aiModel <model>: model to use (overrides the provider's default). -
--aiPrompt <prompt>: system prompt prefixed to every submission. -
--aiHistoryCount <count>: number of previous REPL entries sent as context (default5).
Each option is repeatable. See Keyboard Shortcuts for the defaults.
-
--triggerCompletionListKeys <binding>: open the completion list. -
--newLineKeys <binding>: insert a newline. -
--submitPromptKeys <binding>: submit the prompt. -
--submitPromptDetailedKeys <binding>: submit with detailed output.
-
--trace: write a trace file in the current directory, for bug reports. -
-v,--version: print the version and exit. -
-h,--help: print help and exit.
-
inspect <pid>: connect to a running, inspector-enabled process. The options above also apply to the remote session. -
inspect list: list the running, inspector-enabled processes you can connect to. -
inspect init [--shell pwsh|powershell|cmd|bash|fish]: print the environment variables to launch your app with.
Once attached, the REPL gains the #replace, #wrap, #patches, and #revert commands for modifying live methods. See Inspecting a Running Process.
C# REPL reads a config file containing any of the options above, one per line. Run csharprepl --configure to open it in your editor (it reads the EDITOR environment variable).
Location:
- Windows:
C:\Users\<username>\AppData\Roaming\.csharprepl\config.rsp - Linux and macOS:
~/.config/.csharprepl/config.rsp
With dotnet-suggest enabled, options tab-complete, including --framework values and --using namespaces.