DocsCodeRun C# Code

Run a C# snippet in RunMacro

RunMacro RunnerRunMacro 3.5+

The Run C# Code command inserts and runs a C# snippet.

Dialog & quick setup

RunMacro Run C# Code command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Run C# Code command in RunMacro.
  1. Add a Code › Run C# Code command.
  2. Enter your C# snippet.
  3. Use Console.WriteLine(...) to output to the log. Save.

Options reference

Code content

The C# snippet to run. With only csc (C# 5), some newer syntax like interpolated strings is auto-downgraded.

Modes & when to use

RunMacro Runner

Best for

  • Leverage .NET libraries for a special task.
  • Handle complex logic in C#.
  • Integrate a C# computation/formatting snippet.

Use an alternative when

  • Do not run unreviewed C# or when required compiler/runtime/references are unavailable.
Before you run
  • Add Run C# Code to the macro.
  • Prepare the data or target that Run C# Code will use.

Example workflow

Example: print a line

  1. Run C# Code with Console.WriteLine("Hello");.
  2. The line appears in the log.
Expected result: After execution, Run C# Code completes the described action and makes its result available to the next step.

Tips & limitations

You need dotnet-script, csi, or csc.exe available; otherwise the command reports it cannot run.
  • Compilation can fail by version/reference; the assembly runs with process permissions and can modify the system.

Applies to RunMacro 3.5+ · RunMacro Runner · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.