dotnet-execute 0.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global dotnet-execute --version 0.5.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local dotnet-execute --version 0.5.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-execute&version=0.5.0
                    
nuke :add-package dotnet-execute --version 0.5.0
                    

dotnet-exec

dotnet-execute

dotnet-execute Latest

default

Intro

dotnet-exec is a command line tool for executing C# program without a project file, and you can have your custom entry point other than Main method

Install/Update

Latest stable version:

dotnet tool update -g dotnet-execute

Latest preview version:

dotnet tool update -g dotnet-execute --prerelease

Examples

Execute local file:

dotnet-exec HttpPathJsonSample.cs

Execute local file with custom entry point:

dotnet-exec HttpPathJsonSample.cs --entry MainTest

Execute remote file:

dotnet-exec https://github.com/WeihanLi/SamplesInPractice/blob/master/net7Sample/Net7Sample/ArgumentExceptionSample.cs

Execute file with preview features:

dotnet-exec RawStringLiteral.cs --preview

Execute raw code:

dotnet-exec 'code:Console.WriteLine(1+1);'

Execute raw code with custom usings:

dotnet-exec 'code:WriteLine(1+1);' --using "static System.Console"

Execute raw code with docker

docker run --rm weihanli/dotnet-exec:0.4.0 dotnet-exec "code:(1+1).Dump()"

More

LanguageVersion

By default, it's using the latest language version, you can use the Preview version with --preview/--lang-version=Preview

EntryPoint

By default, it would use MainTest as the entry point, you can customize with --entry option

TargetFramework

By default, it would use net7.0 if you've installed .NET 7 SDK, otherwise use .NET 6 instead, you can customize with the -f/--framework option

CompilerType

By default, it would use the DefaultCodeCompiler to compile the code, you can customize with the --compiler-type option, and you can use -a/--advanced for --compiler-type=advanced

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.33.0 883 11/20/2025
0.33.0-preview-20251113-005230 295 11/13/2025
0.33.0-preview-20251015-123253 325 10/15/2025
0.32.0 1,770 9/11/2025
0.32.0-preview-20250911-001745 188 9/11/2025
0.32.0-preview-20250825-230929 297 8/25/2025
0.31.0 702 8/17/2025
0.31.0-preview-20250814-173628 202 8/14/2025
0.30.0 1,100 7/25/2025
0.30.0-preview-20250725-024058 496 7/25/2025
0.30.0-preview-20250724-010253 519 7/24/2025
0.30.0-preview-20250723-170211 560 7/23/2025
0.30.0-preview-20250723-163836 575 7/23/2025
0.30.0-preview-20250723-155751 569 7/23/2025
0.30.0-preview-20250723-154642 568 7/23/2025
0.30.0-preview-20250723-003045 575 7/23/2025
0.30.0-preview-20250718-001208 198 7/18/2025
0.30.0-preview-20250715-051839 202 7/15/2025
0.30.0-preview-20250616-043224 266 6/16/2025
0.29.0 1,072 6/14/2025
0.29.0-preview-20250614-064855 186 6/14/2025
0.29.0-preview-20250611-150843 338 6/11/2025
0.29.0-preview-20250611-014826 338 6/11/2025
0.29.0-preview-20250609-171136 308 6/9/2025
0.28.0 875 5/22/2025
0.28.0-preview-20250516-140312 293 5/16/2025
0.28.0-preview-20250412-015004 375 4/12/2025
0.28.0-preview-20250330-151243 369 3/30/2025
0.27.0 1,879 3/29/2025
0.27.0-preview-20250329-061056 201 3/29/2025
0.27.0-preview-20250320-150236 242 3/20/2025
0.26.0 882 3/8/2025
0.26.0-preview-20250308-054159 317 3/8/2025
0.26.0-preview-20250308-052015 297 3/8/2025
0.26.0-preview-20250306-003649 299 3/6/2025
0.26.0-preview-20250304-161120 388 3/4/2025
0.26.0-preview-20250304-153109 377 3/4/2025
0.26.0-preview-20250213-145629 404 2/13/2025
0.26.0-preview-20250104-155937 413 1/4/2025
0.25.0 3,103 12/15/2024
0.25.0-preview-20241206-154703 388 12/6/2024
0.25.0-preview-20241205-003755 221 12/5/2024
0.25.0-preview-20241205-001213 172 12/5/2024
0.24.0 1,758 11/24/2024
0.24.0-preview-20241124-035720 261 11/24/2024
0.24.0-preview-20241117-021926 365 11/17/2024
0.24.0-preview-20241025-003522 516 10/25/2024
0.24.0-preview-20241010-163230 336 10/10/2024
0.24.0-preview-20241009-161812 411 10/9/2024
0.24.0-preview-20241009-152619 259 10/9/2024
0.24.0-preview-20241004-001036 424 10/4/2024
0.24.0-preview-20241003-015422 335 10/3/2024
0.24.0-preview-20241002-173926 327 10/2/2024
0.24.0-preview-20240918-153023 409 9/18/2024
0.24.0-preview-20240911-171636 288 9/11/2024
0.23.0 3,916 8/29/2024
0.23.0-preview-20240824-102835 264 8/24/2024
0.23.0-preview-20240815-002214 434 8/15/2024
0.22.0 2,146 7/10/2024
0.21.0 1,301 6/15/2024
0.20.0 702 6/6/2024
0.19.0 1,849 4/21/2024
0.18.1 2,649 3/2/2024
0.18.0 859 3/1/2024
0.17.0 1,217 2/6/2024
0.16.0 1,556 1/5/2024
0.15.0 1,622 11/23/2023
0.14.0 2,176 4/22/2023
0.13.0 2,101 3/16/2023
0.12.0 2,212 12/3/2022
0.11.0 2,113 11/22/2022
0.10.0 2,029 11/15/2022
0.9.0 2,047 11/9/2022
0.8.0 2,207 10/26/2022
0.7.0 2,319 7/17/2022
0.6.0 2,423 7/1/2022
0.5.0 2,348 6/26/2022
0.4.0 2,362 6/18/2022
0.3.0 2,825 6/5/2022
0.2.0 2,533 5/29/2022
0.1.1 4,952 5/4/2022
0.1.0 2,721 5/4/2022