Kephas.Scripting.CSharp
11.1.0
Prefix Reserved
dotnet add package Kephas.Scripting.CSharp --version 11.1.0
NuGet\Install-Package Kephas.Scripting.CSharp -Version 11.1.0
<PackageReference Include="Kephas.Scripting.CSharp" Version="11.1.0" />
<PackageVersion Include="Kephas.Scripting.CSharp" Version="11.1.0" />
<PackageReference Include="Kephas.Scripting.CSharp" />
paket add Kephas.Scripting.CSharp --version 11.1.0
#r "nuget: Kephas.Scripting.CSharp, 11.1.0"
#:package Kephas.Scripting.CSharp@11.1.0
#addin nuget:?package=Kephas.Scripting.CSharp&version=11.1.0
#tool nuget:?package=Kephas.Scripting.CSharp&version=11.1.0
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 | Versions 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. |
-
.NETStandard 2.1
- Kephas.Scripting (>= 11.1.0)
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.1.0)
-
net6.0
- Kephas.Scripting (>= 11.1.0)
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.1.0)
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 | 899 | 4/13/2022 |
| 11.1.0-dev.4 | 280 | 4/6/2022 |
| 11.1.0-dev.3 | 261 | 3/30/2022 |
| 11.1.0-dev.2 | 267 | 3/23/2022 |
| 11.1.0-dev.1 | 264 | 3/23/2022 |
| 11.0.0 | 681 | 3/11/2022 |
| 11.0.0-dev.7 | 270 | 3/7/2022 |
| 11.0.0-dev.6 | 293 | 2/28/2022 |
| 11.0.0-dev.5 | 288 | 2/26/2022 |
| 11.0.0-dev.4 | 285 | 2/24/2022 |
| 11.0.0-dev.3 | 286 | 2/23/2022 |
| 11.0.0-dev.2 | 278 | 2/18/2022 |
| 11.0.0-dev.1 | 285 | 2/7/2022 |
| 10.3.0 | 667 | 1/18/2022 |
| 10.2.0 | 1,024 | 12/3/2021 |
| 10.1.0 | 5,094 | 11/23/2021 |
| 10.1.0-dev.7 | 339 | 11/17/2021 |
| 10.1.0-dev.6 | 314 | 11/16/2021 |
| 10.1.0-dev.5 | 314 | 11/10/2021 |
| 10.1.0-dev.4 | 301 | 11/8/2021 |
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.