Skip to content

Commit 3cb94ee

Browse files
committed
Release v4.14.2
- fix for the accidental left over scope for #451
1 parent 39b0892 commit 3cb94ee

20 files changed

Lines changed: 224 additions & 60 deletions

File tree

help.txt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
C# Script execution engine (.NET Core). Version 4.14.0.0.
1+
C# Script execution engine (.NET Core). Version 4.14.2.0.
22
Copyright (C) 2004-2026 Oleg Shilo.
33

44
Usage: cscs <switch 1> <switch 2> <file> [params] [//x]
@@ -842,7 +842,8 @@ This directive is used to select compiler services for building a script into an
842842
For csc more detailed information see css -ng ? help documentation.
843843
roslyn - use Microsoft.CodeAnalysis.CSharp.Scripting.dll (Roslyn).
844844
This compiler shows good performance and does not require .NET SDK. Though, it is not suitable for WPF
845-
scripts. ${<==}For roslyn-inproc version of this parameter see css -ng ? help documentation.
845+
scripts.
846+
For roslyn-inproc version of this parameter see css -ng ? help documentation.
846847
See [this wiki](https://github.com/oleg-shilo/cs-script/wiki/Choosing-Compiler-Engine) for details.
847848

848849
Example: //css_engine csc
@@ -945,7 +946,29 @@ The following is the optional set of environment variables that the script engin
945946
useful for the advanced debugging scenarios. Of the environment variable is not set or the value is not a valid
946947
file path then no log file will be created.
947948

949+
'css_cli_roslyn_new_algorithm'
950+
a non empty envar will trigger the use of a new algorithm of the Roslyn compiler in CLI scenarios.
951+
This algorithm allows using a normal C# syntax that allows namespaces.
952+
953+
'css_csc_file'
954+
the location of the csc.dll from the SDK folder. Useful if the default probing algorithm of the script engine
955+
cannot find the right compiler file.
956+
Ie, 'C:\Program Files\dotnet\sdk\10.0.103\Roslyn\bincore\csc.dll'.
957+
958+
'css_csc_asm_refs_dir'
959+
the location of the csc.dll from the SDK folder. Useful if the default probing algorithm of the script engine
960+
cannot find the right compiler file.
961+
Ie, 'C:\Users\user\.nuget\packages\microsoft.AspNetCore.app.ref\10.0.3\ref\net10.0'.
962+
963+
'css_prefer_sdk_toolset_nuget'
964+
controls whether SDK tools are preferred over the SDK NuGet Toolset package. Used when locating csc.exe/dll
965+
compilers.
966+
948967
---------
968+
969+
'css_csc_file'
970+
the location of the csc.dll from the SDK folder.
971+
949972
During the script execution CS-Script always injects a little object inspector class 'dbg'. This class contains static
950973
printing methods that mimic Python's 'print()'. It is particularly useful for object inspection in the absence of a
951974
proper debugger.

scoop-bucket/cs-script.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"version": "4.13.1.0",
2+
"version": "4.14.0.0",
33
"description": "CS-Script is a C# scripting platform for Windows.",
44
"homepage": "https://github.com/oleg-shilo/cs-script",
55
"license": "MIT",
6-
"url": "https://github.com/oleg-shilo/cs-script/releases/download/v4.13.1.0/cs-script.win.v4.13.1.0.zip",
7-
"hash": "sha256:1073FC397938CBA5C1097FACB9DDB407E257D1000DAA5965B483B8F90EB3D588",
6+
"url": "https://github.com/oleg-shilo/cs-script/releases/download/v4.14.0.0/cs-script.win.v4.14.0.0.zip",
7+
"hash": "sha256:c671c2e07376683924aa7e2cc14e6226549878e7cd8603326b6b105759a82b86",
88
"bin": [["cscs.exe", "css"]],
99
"checkver": {
1010
"github": "oleg-shilo/cs-script"

src/CSScriptLib/src/CSScriptLib/CSScriptLib.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1616
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1717
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
18-
<Version>4.14.0</Version>
18+
<Version>4.14.2</Version>
1919
<Authors>Oleg Shilo</Authors>
2020
<Description>CS-Script engine Class Library for .NET</Description>
2121
<Copyright>(C) 2018-2026 Oleg Shilo</Copyright>
@@ -27,7 +27,7 @@
2727
<PackageTags>C#, scripting, script, dynamic, .NET. .NET Core</PackageTags>
2828
<PackageReleaseNotes>---
2929

30-
## Changes
30+
## Changes (v4.14.0-4.14.2)
3131

3232
The major changes in this release are around improved support for working with external compile engines in CodeDom evaluator mode. Now both, CLI and CSScriptLib APIs allow automatic download and deployment of the latest .NET compilers (nuget packages) on the target system so the user does not have to install the complete .NET SDK.
3333

@@ -86,9 +86,9 @@ CS-Script now uses separate temporary directories for better isolation:
8686
├── cache\ # Compiled script cache
8787
└── tmp files # Temporary compilation artifacts</PackageReleaseNotes>
8888
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
89-
<AssemblyVersion>4.14.0</AssemblyVersion>
90-
<FileVersion>4.14.0</FileVersion>
91-
<PackageVersion>4.14.0</PackageVersion>
89+
<AssemblyVersion>4.14.2</AssemblyVersion>
90+
<FileVersion>4.14.2</FileVersion>
91+
<PackageVersion>4.14.2</PackageVersion>
9292
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9393
<PackageIcon>css_logo.png</PackageIcon>
9494
<SignAssembly>True</SignAssembly>

src/CSScriptLib/src/Client.NET/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ static void PrepareCodeDomCompilers()
157157
// you will need to install the compiler by downloading SDK tools NuGet package.
158158
// Either manually from
159159
// https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.compilers.toolset/10.0.103/microsoft.net.sdk.compilers.toolset.10.0.103.nupkg
160-
// or by using CS-Script's own downloader. Uncomment next two lines:
160+
// Or by executing `css -deploy-csc` command in the terminal, which will download and extract the package to the default location.
161+
// Or by using CS-Script's own downloader. Uncomment next two lines:
161162
//
162163
// NugetPackageDownloader.OnProgressOutput = Console.WriteLine;
163164
// NugetPackageDownloader.DownloadLatestSdkCompiler(includePrereleases: false);
@@ -166,8 +167,8 @@ static void PrepareCodeDomCompilers()
166167

167168
// Globals.csc is internally initialized the same way. Providing it here for demo purposes only.
168169
Globals.csc =
169-
Globals.FindSdkToolsetPackageCompiler(includePrereleases: false) ?? // from the installed Microsoft.Net.Sdk.Compilers.Toolset package
170-
Globals.FindSdKCompiler(); // or from .NET SDK installed on OS
170+
Globals.FindSdKCompiler() ?? // or from .NET SDK installed on OS
171+
Globals.FindSdkToolsetPackageCompiler(includePrereleases: false); // from the installed Microsoft.Net.Sdk.Compilers.Toolset package
171172
}
172173
}
173174

src/Tests.CSScriptLib/Evaluator.Roslyn.Tests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,17 @@ public string foo()
489489
util = CSScript.Evaluator.LoadCode(code);
490490
result = util.foo();
491491
Assert.Equal("test", result);
492+
493+
// =================================
494+
495+
var scriptFile = testTempFile("script1.cs");
496+
File.WriteAllText(scriptFile, code);
497+
var scriptAsmFile = testTempFile("script1.cs.dll");
498+
var resultAsm = CSScript.Evaluator.CompileAssemblyFromFile(scriptFile, scriptAsmFile);
499+
util = Assembly.LoadFrom(resultAsm).CreateObject("*");
500+
501+
result = util.foo();
502+
Assert.Equal("test", result);
492503
}
493504

494505
[Fact]

src/chocolatey/cs-script.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>cs-script</id>
5-
<version>4.14.0</version>
5+
<version>4.14.2</version>
66
<title>CS-Script</title>
77
<authors>Oleg Shilo</authors>
88
<owners>Oleg Shilo</owners>
@@ -26,7 +26,7 @@
2626
<summary>CS-Script</summary>
2727
<releaseNotes>---
2828

29-
## Changes
29+
## Changes (v4.14.0-4.14.2)
3030

3131
The major changes in this release are around improved support for working with external compile engines in CodeDom evaluator mode. Now both, CLI and CSScriptLib APIs allow automatic download and deployment of the latest .NET compilers (nuget packages) on the target system so the user does not have to install the complete .NET SDK.
3232

src/chocolatey/publish.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
echo off
22
rem choco apikey --key ???????? --source https://push.chocolatey.org/
33

4-
choco push cs-script.4.13.1.nupkg --source https://push.chocolatey.org/
4+
choco push cs-script.4.14.0.nupkg --source https://push.chocolatey.org/
55
pause

src/chocolatey/tools/chocolateyInstall.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
$packageName = 'cs-script'
2-
$url = 'https://github.com/oleg-shilo/cs-script/releases/download/v4.13.1.0/cs-script.win.v4.13.1.0.7z'
2+
$url = 'https://github.com/oleg-shilo/cs-script/releases/download/v4.14.0.0/cs-script.win.v4.14.0.0.7z'
33

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

7-
$checksum = '336BF88C084F4DE9D54E691734F2787C7883EDBC979FD8C1FDAE5A5D23139246'
7+
$checksum = '7542DB2B54B738BF0FF7303206B5D6162CE4924EBAC2C2B334BFBFD810AD0183'
88
$checksumType = "sha256"
99

1010
function stop-server

src/chocolatey/update_package.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
ServicePointManager.Expect100Continue = true;
1010
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
1111

12-
var url = "https://github.com/oleg-shilo/cs-script/releases/download/v4.13.1.0/cs-script.win.v4.13.1.0.7z";
12+
var url = "https://github.com/oleg-shilo/cs-script/releases/download/v4.14.0.0/cs-script.win.v4.14.0.0.7z";
1313

1414
var installScript = @"tools\chocolateyInstall.ps1";
1515

@@ -37,4 +37,4 @@ string calcChecksum(string url)
3737

3838
var checksum = cmd.run(@"C:\ProgramData\chocolatey\tools\checksum.exe", "-t sha256 -f \"" + file + "\"", echo: false).Trim();
3939
return checksum;
40-
}
40+
}

src/cscs/CodeDom/CSharpCompiler.engines.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,15 @@ bool not_facade_asm_in_engine_dir(string asm)
312312

313313
// need to remove duplicated assemblies leaving GAC as a preferable reference
314314
// IE System.Linq.dll exists in GAC and in packages where it can be of a different version so it should not be used.
315+
// A special case of System.Windows.Forms.dll coming explicitly because of the //css_winApp, and yet it may not be present in GAC
315316
var new_ref_assemblies = ref_assemblies
316-
.Where(x => !gac_asms.Any(y => Path.GetFileName(y) == Path.GetFileName(x)))
317-
.Where(x => !x.IsRuntimeAssembly());
317+
.Where(x => !gac_asms.Any(y => Path.GetFileName(y) == Path.GetFileName(x)));
318+
319+
// Interestingly enough the extra filter !IsRuntimeAssembly filter was introduced in 4.14.0
320+
// But it started causing the problems in case of injecting framework assemblies so I covered
321+
// the case of "System.Windows.Forms.dll" specifically.
322+
// Maybe we don't really need this extra filter. Need to investigate;
323+
// .Where(x => !x.IsRuntimeAssembly());
318324

319325
foreach (string file in gac_asms.Concat(new_ref_assemblies))
320326
refs_args.Add($"/r:\"{file}\"");

0 commit comments

Comments
 (0)