Kephas.Scripting.CSharp 11.1.0-dev.3

Prefix Reserved
This is a prerelease version of Kephas.Scripting.CSharp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kephas.Scripting.CSharp --version 11.1.0-dev.3
                    
NuGet\Install-Package Kephas.Scripting.CSharp -Version 11.1.0-dev.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kephas.Scripting.CSharp" Version="11.1.0-dev.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kephas.Scripting.CSharp" Version="11.1.0-dev.3" />
                    
Directory.Packages.props
<PackageReference Include="Kephas.Scripting.CSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kephas.Scripting.CSharp --version 11.1.0-dev.3
                    
#r "nuget: Kephas.Scripting.CSharp, 11.1.0-dev.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kephas.Scripting.CSharp@11.1.0-dev.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kephas.Scripting.CSharp&version=11.1.0-dev.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Kephas.Scripting.CSharp&version=11.1.0-dev.3&prerelease
                    
Install as a Cake Tool

C# Scripting

Introduction

The C# scripting area in Kephas handles C# dynamic code execution using Microsoft.CodeAnalysis.CSharp.Scripting.

Check the following packages for more information:

Usage

  • String based script execution
// normally you would get the processor injected into the service constructor.
var processor = injector.Resolve<IScriptProcessor>();

var script = new CSharpStringScript(
@"int Power(int a) => a * a;
return Power((int)value) + 3;
");
var result = await processor.ExecuteAsync(script), new { value = 5 })).PreserveThreadContext();
Assert.Equals(28, result);
  • File based script execution

The file scripts assume that the language can be inferred from the file extension. For C#, it means that the file needs to and with a *.cs or *.csx extension. If this is not the case, make sure you specify the language explicitly when creating a FileScript.

// normally you would get the processor injected into the service constructor.
var processor = injector.Resolve<IScriptProcessor>();

// C# scripts ending with *.csx
var result = await processor.ExecuteAsync(new FileScript("myscript.csx"), new { value = 5 })).PreserveThreadContext();
Assert.Equals(28, result);

// C# scripts not ending with *.csx or *.cs
var result = await processor.ExecuteAsync(new FileScript("myscript.txt", CSharpLanguageService.Language), new { value = 5 })).PreserveThreadContext();
Assert.Equals(28, result);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.1.0 818 4/13/2022
11.1.0-dev.4 233 4/6/2022
11.1.0-dev.3 220 3/30/2022
11.1.0-dev.2 224 3/23/2022
11.1.0-dev.1 216 3/23/2022
11.0.0 637 3/11/2022
11.0.0-dev.7 234 3/7/2022
11.0.0-dev.6 231 2/28/2022
11.0.0-dev.5 234 2/26/2022
11.0.0-dev.4 231 2/24/2022
11.0.0-dev.3 234 2/23/2022
11.0.0-dev.2 228 2/18/2022
11.0.0-dev.1 237 2/7/2022
10.3.0 618 1/18/2022
10.2.0 982 12/3/2021
10.1.0 5,049 11/23/2021
10.1.0-dev.7 287 11/17/2021
10.1.0-dev.6 259 11/16/2021
10.1.0-dev.5 271 11/10/2021
10.1.0-dev.4 256 11/8/2021
10.1.0-dev.3 243 11/8/2021
10.1.0-dev.2 261 11/4/2021
10.1.0-dev.1 259 11/3/2021
10.0.1 575 10/16/2021
10.0.0 538 10/13/2021
10.0.0-dev.4 252 10/13/2021
10.0.0-dev.3 270 10/11/2021
10.0.0-dev.2 321 10/8/2021
9.3.4 527 8/25/2021
9.3.3 510 8/25/2021
9.3.2 527 8/24/2021
9.3.1 515 8/12/2021
9.3.0 546 8/12/2021
9.2.0 526 6/17/2021
9.1.0 542 6/17/2021
9.1.0-dev.9 298 5/26/2021
9.1.0-dev.8 287 5/26/2021
9.1.0-dev.7 291 5/17/2021
9.1.0-dev.6 284 4/28/2021
9.1.0-dev.5 291 4/23/2021
9.1.0-dev.4 301 4/21/2021
9.1.0-dev.3 290 4/17/2021
9.1.0-dev.2 287 4/12/2021
9.1.0-dev.1 352 4/9/2021
9.0.5 534 3/31/2021
9.0.4 565 3/23/2021
9.0.3 580 3/20/2021
9.0.1 540 3/18/2021
9.0.0 555 3/17/2021
9.0.0-dev.4 298 3/4/2021
9.0.0-dev.3 308 3/1/2021
9.0.0-dev.2 329 2/22/2021
8.4.0 599 11/11/2020
8.3.0 611 10/28/2020
8.2.0 685 10/16/2020
8.1.0 721 9/23/2020
8.0.0 659 7/1/2020
8.0.0-dev.44 413 6/25/2020
8.0.0-dev.43 399 6/23/2020
8.0.0-dev.42 426 6/22/2020
8.0.0-dev.41 415 6/18/2020
8.0.0-dev.40 392 6/18/2020
8.0.0-dev.39 405 6/15/2020
8.0.0-dev.38 515 6/14/2020
8.0.0-dev.37 375 6/13/2020
8.0.0-dev.36 424 6/13/2020
8.0.0-dev.35 365 6/12/2020
8.0.0-dev.34 408 6/12/2020
8.0.0-dev.33 456 6/10/2020
8.0.0-dev.32 380 6/1/2020
8.0.0-dev.31 403 6/1/2020
8.0.0-dev.30 475 5/30/2020
8.0.0-dev.28 419 5/28/2020
8.0.0-dev.27 402 5/15/2020
8.0.0-dev.26 384 5/14/2020
8.0.0-dev.25 411 5/14/2020
8.0.0-dev.24 397 5/13/2020
8.0.0-dev.23 403 5/13/2020
8.0.0-dev.22 401 5/13/2020
8.0.0-dev.21 396 5/12/2020
8.0.0-dev.20 396 5/12/2020
8.0.0-dev.19 409 5/7/2020
8.0.0-dev.18 402 5/7/2020
8.0.0-dev.17 398 5/6/2020
8.0.0-dev.16 399 5/6/2020
8.0.0-dev.15 392 5/5/2020
8.0.0-dev.14 392 5/5/2020
8.0.0-dev.13 424 5/4/2020
7.6.0-dev.13 423 5/1/2020
7.6.0-dev.12 426 4/30/2020
7.6.0-dev.11 391 4/28/2020
7.6.0-dev.10 392 4/27/2020
7.6.0-dev.9 379 4/24/2020
7.6.0-dev.8 398 4/22/2020
7.6.0-dev.7 394 4/15/2020
7.6.0-dev.6 386 4/15/2020
7.6.0-dev.5 383 4/15/2020
7.6.0-dev.4 505 4/11/2020
7.6.0-dev.3 383 4/10/2020
7.6.0-dev.2 378 4/10/2020
7.6.0-dev.1 453 4/8/2020
7.5.2 743 3/20/2020
7.5.1 676 3/12/2020
7.5.0 688 3/10/2020
7.5.0-dev.18 413 3/5/2020
7.5.0-dev.17 414 3/5/2020
7.5.0-dev.16 429 3/4/2020
7.5.0-dev.15 377 3/3/2020
7.5.0-dev.14 388 3/3/2020
7.5.0-dev.13 380 2/29/2020
7.5.0-dev.12 497 2/29/2020
7.5.0-dev.10 374 2/25/2020
7.5.0-dev.9 422 2/20/2020
7.5.0-dev.8 445 2/18/2020
7.5.0-dev.7 376 2/18/2020
7.5.0-dev.6 399 2/14/2020
7.5.0-dev.5 431 2/12/2020
7.5.0-dev.4 396 2/11/2020
7.5.0-dev.3 370 2/11/2020
7.5.0-dev.2 512 2/8/2020
7.5.0-dev.1 402 2/7/2020
7.4.2 678 2/5/2020
7.4.1 748 2/3/2020
7.4.0 761 1/31/2020
7.4.0-dev.4 454 1/31/2020
7.4.0-dev.3 428 1/29/2020
7.4.0-dev.2 386 1/28/2020
7.4.0-dev.1 377 1/23/2020
7.3.1 779 1/21/2020
7.3.1-preview.7 386 1/21/2020
7.3.1-preview.1 416 1/20/2020
7.3.0 674 1/19/2020
7.2.6 757 1/18/2020
7.2.5 715 12/19/2019
7.2.4 724 12/19/2019
7.2.3 730 12/16/2019
7.2.2 693 12/9/2019
7.2.1 713 12/4/2019
7.2.0 666 11/26/2019
7.2.0-preview.10 389 11/20/2019
7.2.0-preview.9 393 11/19/2019
7.2.0-preview.8 389 11/18/2019
7.2.0-preview.6 401 11/14/2019
7.2.0-preview.5 403 11/14/2019
7.2.0-preview.4 386 11/14/2019
7.2.0-preview.2 391 11/11/2019
7.2.0-preview.1 392 11/9/2019
7.1.0 715 11/6/2019
7.1.0-preview.8 402 11/5/2019
7.1.0-preview.7 394 11/4/2019
7.1.0-preview.6 393 11/1/2019
7.1.0-preview.5 414 10/31/2019
7.1.0-preview.4 416 10/30/2019
7.1.0-preview.3 401 10/26/2019
7.1.0-preview.2 399 10/25/2019
7.1.0-preview.1 400 10/24/2019
7.0.0 692 10/16/2019
7.0.0-rc.41 407 10/15/2019
7.0.0-rc.40 420 10/15/2019
7.0.0-rc.39 411 10/12/2019
7.0.0-rc.38 403 10/11/2019
7.0.0-rc.37 404 10/10/2019
7.0.0-rc.36 399 10/9/2019
7.0.0-rc.35 401 10/8/2019
7.0.0-rc.34 404 10/8/2019
7.0.0-rc.33 400 10/7/2019
7.0.0-rc.32 395 10/5/2019
7.0.0-rc.31 403 10/3/2019
7.0.0-rc.30 412 10/1/2019
7.0.0-rc.28 408 10/1/2019
7.0.0-rc.27 396 9/30/2019
7.0.0-rc.26 409 9/30/2019
7.0.0-rc.25 393 9/27/2019
7.0.0-rc.24 396 9/27/2019
7.0.0-rc.23 388 9/26/2019
7.0.0-rc.22 402 9/25/2019
7.0.0-rc.21 407 9/24/2019
7.0.0-rc.20 407 9/23/2019
7.0.0-rc.19 399 9/20/2019
7.0.0-rc.18.1 403 9/20/2019
7.0.0-rc.18 409 9/20/2019
6.5.0-rc.17 419 9/19/2019
6.5.0-rc.16 421 9/18/2019
6.5.0-rc.15 426 9/18/2019
6.5.0-rc.14.1 427 9/18/2019
6.5.0-rc.14 422 9/17/2019
6.5.0-rc.13 414 9/16/2019
6.5.0-rc.12.2 413 9/13/2019
6.5.0-rc.12.1 418 9/12/2019
6.5.0-rc.12 418 9/12/2019
6.5.0-rc.11 415 9/11/2019
6.5.0-rc.10 408 9/10/2019
6.5.0-rc.9 407 9/9/2019
6.5.0-rc.8 405 9/6/2019
6.5.0-rc.7 415 9/6/2019
6.5.0-rc.6 416 9/6/2019
6.5.0-rc.5 407 9/2/2019
6.5.0-rc.4 415 9/2/2019
6.5.0-rc.3 408 8/30/2019
6.5.0-rc.2 432 8/29/2019
6.5.0-rc.1 415 8/28/2019
6.5.0-beta.5 420 8/28/2019
6.5.0-beta.4 419 8/27/2019
6.0.0 756 8/6/2019
6.0.0-rc.7 407 7/19/2019
6.0.0-rc.6 420 6/28/2019
6.0.0-rc.5 405 6/28/2019
6.0.0-rc.4 409 6/25/2019
6.0.0-rc.3 420 6/20/2019
6.0.0-rc.2 415 5/29/2019
6.0.0-rc.1 418 5/28/2019
6.0.0-beta.3 430 4/17/2019
5.3.0-beta.2 425 3/21/2019
5.3.0-beta.1 422 3/20/2019
5.2.0 753 3/19/2019
5.1.0 1,155 1/25/2019
5.0.0 1,216 12/21/2018
5.0.0-rc11 973 12/14/2018
5.0.0-rc10 741 11/16/2018
5.0.0-rc09 739 11/1/2018
5.0.0-rc08 707 10/31/2018
5.0.0-rc07 742 10/31/2018
5.0.0-rc06 743 10/30/2018
5.0.0-rc05 738 10/29/2018
5.0.0-rc04 770 10/29/2018
5.0.0-rc03 752 10/26/2018
5.0.0-rc02 741 10/25/2018
5.0.0-rc01 790 10/12/2018
5.0.0-beta03 794 9/21/2018
5.0.0-beta02 806 9/10/2018
5.0.0-beta01 798 9/7/2018
4.5.1 1,197 8/7/2018
4.5.0 1,174 8/7/2018
4.5.0-rc01 1,158 6/7/2018
4.5.0-beta09 1,141 6/7/2018

Please check https://github.com/kephas-software/kephas/releases for the change log.
           Also check the documentation and the samples from https://github.com/kephas-software/kephas/wiki and https://github.com/kephas-software/kephas/tree/master/Samples.