Downloads of v


Last Update:

22 Mar 2021

Package Maintainer(s):

Software Author(s):

  • Oleg Shilo


cs-script C# script dynamic hosting

CS-Script | Updated: 22 Mar 2021



Downloads of v



Software Author(s):

  • Oleg Shilo


All Checks are Passing

2 Passing Test

Validation Testing Passed

Verification Testing Passed


To install CS-Script, run the following command from the command line or from PowerShell:


To upgrade CS-Script, run the following command from the command line or from PowerShell:


To uninstall CS-Script, run the following command from the command line or from PowerShell:


NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Enter your internal repository url

(this should look similar to

4. Choose your deployment method:

choco upgrade cs-script -y --source="'STEP 3 URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:

choco upgrade cs-script -y --source="'STEP 3 URL'"

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0

Exit $exitCode

- name: Ensure cs-script installed
    name: cs-script
    state: present
    source: STEP 3 URL

See docs at

chocolatey_package 'cs-script' do
  action    :install
  version  ''
  source   'STEP 3 URL'

See docs at

    Name: cs-script,
    Source: STEP 3 URL

Requires Otter Chocolatey Extension. See docs at

cChocoPackageInstaller cs-script
   Name     = 'cs-script'
   Ensure   = 'Present'
   Version  = ''
   Source   = 'STEP 3 URL'

Requires cChoco DSC Resource. See docs at

package { 'cs-script':
  provider => 'chocolatey',
  ensure   => '',
  source   => 'STEP 3 URL',

Requires Puppet Chocolatey Provider module. See docs at

salt '*' chocolatey.install cs-script version="" source="STEP 3 URL"

See docs at

5. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Private CDN cached downloads available for licensed customers. Never experience 404 breakages again! Learn more...

This package was approved as a trusted package on 22 Mar 2021.


CLR based runtime environment for executing scripts written in ECMA-compliant C#.
The main idea of CS-Script is to allow "plain vanilla" C# code execution from both command-prompt and form any CLR application hosting the script engine.

CS-Script targets .NET 5.

The default installation directory is "%ChocolateyInstall%\lib\cs-script".
This package contains the set of scripts and binaries that required for the default functionality. However there is some additional content that represents somewhat less mainstream functionality and experimental features. This content is available as an Extension Pack from the releases page( Installing the Extension Pack is as simple as downloading and extracting the archive to your chocolatey install location (most likely C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script).

$packageName = 'cs-script'
$url = ''

try {
  $installDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

  $cheksum = '6B992FAD8D41B34A3DC2EEC9D06E0B8A77B1E8237385FB3C725890B373605329'
  $checksumType = "sha256"

  function stop-server

    try {

        $client  = New-Object Net.Sockets.TcpClient($server, $port)
        $socketStream  = $client.GetStream()

        [Byte[]]$Buffer = [Text.Encoding]::ASCII.GetBytes($data)

        $socketStream.Write($Buffer, 0, $Buffer.Length)

  stop-server "localhost" "17001" "-exit" # prev release Roslyn compiling server requires "-exit"
  stop-server "localhost" "17001" "-stop" # starting from .NET 5 release CodeDom build server requires "-stop"

  # Download and unpack a zip file
  Install-ChocolateyZipPackage "$packageName" "$url" "$installDir" -checksum $checksum -checksumType $checksumType

  Install-ChocolateyEnvironmentVariable 'CSSCRIPT_DIR' $installDir User
  Install-ChocolateyEnvironmentVariable 'CSSCRIPT_ROOT' $installDir User
} catch {
  throw $_.Exception
$packageName = 'cs-script.core'

function stop-server

    try {

        $client  = New-Object Net.Sockets.TcpClient($server, $port)
        $socketStream  = $client.GetStream()

        [Byte[]]$Buffer = [Text.Encoding]::ASCII.GetBytes($data)

        $socketStream.Write($Buffer, 0, $Buffer.Length)

stop-server "localhost" "17001" "-exit" # prev release Roslyn compiling server requires "-exit"
stop-server "localhost" "17001" "-stop" # starting from .NET 5 release CodeDom build server requires "-stop"

Write-Warning "REmoving 'css' shim $($env:ChocolateyInstall)\lib\cs-script.core\tools"

Uninstall-BinFile "css1" "$($env:ChocolateyInstall)\lib\cs-script.core\tools\cscs.exe"

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Version Downloads Last Updated Status
CS-Script 72 Tuesday, March 16, 2021 Approved
CS-Script 788 Saturday, May 30, 2020 Approved
CS-Script 1361 Wednesday, May 22, 2019 Approved
CS-Script 854 Monday, December 10, 2018 Approved
CS-Script 568 Sunday, September 2, 2018 Approved
CS-Script 363 Thursday, July 19, 2018 Approved
CS-Script 541 Saturday, April 28, 2018 Approved
CS-Script 576 Thursday, March 15, 2018 Approved
CS-Script 827 Monday, August 28, 2017 Approved

Release v4.0.1.0



  • Added support for -verbose2 CLI switch to echo compiling input and output
  • Added //css_webapp support
  • Added checking fro SDK being installed
  • Added cli/web-api sample
  • Issue #234: Could not find a part of the path with CS-Script



- New commands:
-server - for managing build server
-vscode - to open script in VSCode
-vs - to script project in Visual Studio
-self-test - for testing the engine on the target system
-self-exe - for building css launcher for manual deployment
-new:toplevel - CLI parameter
-profile - for testing script loading performance
-speed - for compiler performance testing
- Added css
- Added creation of code.header on first use of CLI command -code
- Added complex (multi-file) commands support (e.g. css -self-test-run)
- Implemented build server
- Implemented hot-loading for csc engine.
- Normalized all \n and \r\n CLI output by using Environment.NewLine
- Added reporting using of incompatible csc compiler for scripts requiring XAML compilation


- Implemented //css_winapp for WinForm and WPF applications
- Added //css_engine (//css_ng) directive for choosing the compiling engine
- Completed CSScript.Evaluator.CodeDom interface.
- Implemented transparent hosting of CSScriptLib in .NET-Framework and .NET-Core
- Removed dependency on Roslyn for pure CodeDom evaluator use-case
- added sample with downloading the latest C# compiler
- added passing compiler options
- Implemented probing for default C#5 compiler when hosted on .NET Framework.
- Extending u-testing to cover new Evaluator features (CSScriptLib.dll)

Discussion for the CS-Script Package

Ground Rules:

  • This discussion is only about CS-Script and the CS-Script package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or CS-Script, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus