Run and debug C# scripts from the .NET CLI with inline NuGet references and full IDE support.
dotnet script is a command-line tool that allows developers to write, run, and debug C# scripts (.csx files) directly from the terminal. It solves the problem of needing to create full .NET projects for small tasks by enabling scripting with inline NuGet package references and full IDE debugging support.
.NET developers looking for a lightweight way to write automation scripts, prototypes, or tools without the ceremony of a full project structure.
Developers choose dotnet script because it combines the power of C# and .NET libraries with the simplicity of scripting, offering features like a REPL, remote script execution, and seamless debugging in VS Code that aren't available in plain .NET CLI.
Run C# scripts from the .NET CLI.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows adding packages directly in scripts with #r 'nuget:' syntax, simplifying dependency handling without project files, as shown in the README with AutoMapper examples.
Supports breakpoints and step-through execution in VS Code with provided launch configurations, making debugging scripts as seamless as full .NET projects, demonstrated in the debugging gif.
Offers a C# Read-Evaluate-Print-Loop for exploratory coding, with support for inline NuGet packages and multiline input, enhancing rapid prototyping.
Works on Windows, Linux, and macOS via .NET CLI global tool, enabling consistent scripting across different operating systems with shebang support on Unix-like systems.
Can execute scripts directly from HTTP URLs like GitHub Gists, facilitating easy sharing and distribution of code snippets without local file storage.
First-time script execution requires dependency resolution and compilation, which can be slow, and caching only works with exact package versions, adding complexity for dynamic dependencies.
Lacks seamless integration with CI/CD pipelines and build systems compared to standard .NET projects, making automation and version management more manual.
Requires .NET SDK installation, which may not be available in all environments, and version compatibility must be managed, as noted in the prerequisites section.