https://github.com/devlooped/dotnet-run
Run a dotnet C# file or script using .NET 10+
https://github.com/devlooped/dotnet-run
Last synced: 8 months ago
JSON representation
Run a dotnet C# file or script using .NET 10+
- Host: GitHub
- URL: https://github.com/devlooped/dotnet-run
- Owner: devlooped
- License: mit
- Created: 2025-05-24T19:42:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-30T00:05:07.000Z (9 months ago)
- Last Synced: 2025-09-30T02:22:56.241Z (9 months ago)
- Size: 15.6 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license.txt
Awesome Lists containing this project
README
# :runner: dotnet-run
Runs a C# file using .NET 10+
## Usage
```
- name: 🏃 C#
uses: devlooped/dotnet-run@v2
with:
# If args has newlines, it will be properly quoted/escaped
args: |
--message
Hi "kzu", I can even mix 'single' quotes
# Script can be an inline C# script, including nuget packages
script: |
#:package Humanizer@2.*
using Humanizer;
var date = DateTime.Parse("${{ github.event.inputs.date }}");
var elapsed = DateTime.Now - date;
if (elapsed.TotalSeconds > 0)
Console.WriteLine($"It's been {elapsed.Humanize()} since {date.Humanize()}");
else
Console.WriteLine($"Still {elapsed.Negate().Humanize()} until {date.Humanize()}");
```
You can also specify a file to run:
```
- name: 🏃 C#
uses: devlooped/dotnet-run@v2
with:
file: ./script.cs
```
The file does not need to have a shebang, but if it does, it will be ignored, since this
action will always run the file using `dotnet run`.
If you give the step an id, you can use the output generated by the script in subsequent steps:
```
- name: 🏃 C#
id: runcs
uses: devlooped/dotnet-run@v2
with:
script: |
Console.WriteLine("Hello world");
- name: 👀 output
# will print "Hello world"
run: echo "${{ steps.runcs.outputs.output }}"
```
The action will automatically install .NET 10+ SDK as needed.
# Sponsors
[](https://github.com/clarius)
[](https://github.com/MFB-Technologies-Inc)
[](https://github.com/torutek-gh)
[](https://github.com/drivenet)
[](https://github.com/Keflon)
[](https://github.com/tbolon)
[](https://github.com/kfrancis)
[](https://github.com/twenzel)
[](https://github.com/unoplatform)
[](https://github.com/rbnswartz)
[](https://github.com/jfoshee)
[](https://github.com/Mrxx99)
[](https://github.com/eajhnsn1)
[](https://github.com/davidjenni)
[](https://github.com/Jonathan-Hickey)
[](https://github.com/akunzai)
[](https://github.com/KenBonny)
[](https://github.com/SimonCropp)
[](https://github.com/agileworks-eu)
[](https://github.com/arsdragonfly)
[](https://github.com/vezel-dev)
[](https://github.com/ChilliCream)
[](https://github.com/4OTC)
[](https://github.com/v-limo)
[](https://github.com/jordansjones)
[](https://github.com/DominicSchell)
[](https://github.com/jwendl)
[](https://github.com/adalon)
[](https://github.com/Eule02)
[](https://github.com/sailro)
[](https://github.com/torutek)
[](https://github.com/sponsors/devlooped)
[Learn more about GitHub Sponsors](https://github.com/sponsors)