8000 GitHub - dotnet-script/dotnet-script: Run C# scripts from the .NET CLI.
[go: up one dir, main page]

Skip to content

dotnet-script/dotnet-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotnet script

Run C# scripts from the .NET CLI, define NuGet packages inline and edit/debug them in VS Code - all of that with full language services support from OmniSharp.

Build status

Build Status

NuGet Packages

Name Version Framework(s)
dotnet-script (global tool) Nuget net8.0,net9.0
Dotnet.Script (CLI as Nuget) Nuget net8.0,net9.0
Dotnet.Script.Core Nuget net8.0,net9.0,netstandard2.0
Dotnet.Script.DependencyModel Nuget netstandard2.0
Dotnet.Script.DependencyModel.Nuget Nuget netstandard2.0

Installing

Prerequisites

The only thing we need to install is .NET 8.0 or .NET 9.0 SDK.

Note:

If you install the .NET SDK to a non-default location, you need to set the environment variable DOTNET_ROOT to the directory that contains the dotnet executable

.NET Core Global Tool

.NET Core 2.1 introduced the concept of global tools meaning that you can install dotnet-script using nothing but the .NET CLI.

dotnet tool install -g dotnet-script

You can invoke the tool using the following command: dotnet-script
Tool 'dotnet-script' (version '0.22.0') was successfully installed.

The advantage of this approach is that you can use the same command for installation across all platforms. .NET Core SDK also supports viewing a list of installed tools and their uninstallation.

dotnet tool list -g

Package Id         Version      Commands
---------------------------------------------
dotnet-script      0.22.0       dotnet-script
dotnet tool uninstall dotnet-script -g

Tool 'dotnet-script' (version '0.22.0') was successfully uninstalled.

Windows

PowerShell script for installation.

(new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/dotnet-script/dotnet-script/master/install/install.ps1") | iex

Linux and Mac

curl -s https://raw.githubusercontent.com/dotnet-script/dotnet-script/master/install/install.sh | bash

If permission is denied we can try with sudo

curl -s https://raw.githubusercontent.com/dotnet-script/dotnet-script/master/install/install.sh | sudo bash

Docker

A Dockerfile for running dotnet-script in a Linux container is available. Build:

cd build
docker build -t dotnet-script -f Dockerfile ..

And run:

docker run -it dotnet-script --version

Github