Skip to content

Commit 6c70cc2

Browse files
committed
# Release v4.11.0.0
--- ## Changes ### CLI - fixed problem with `css -ls <kill-all|ka>` - Added support for pre-release packages `//css_nuget -pre <package>` - WDBG: - Improved tracking of declaration scope - UX improvements - Inject dbg metadata is ported to pure Roslyn. - Detect debug metadata out of sync and report it (2) ### CSScriptLib - Added NativeAOT sample - CodeDomEvaluator.CompileOnServer is made obsolete (with error)
1 parent f83d758 commit 6c70cc2

File tree

14 files changed

+137
-141
lines changed

14 files changed

+137
-141
lines changed

help.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
C# Script execution engine (.NET Core). Version 4.10.1.0.
1+
C# Script execution engine (.NET Core). Version 4.11.0.0.
22
Copyright (C) 2004-2023 Oleg Shilo.
33

44
Usage: cscs <switch 1> <switch 2> <file> [params] [//x]
@@ -402,6 +402,8 @@ params Specifies optional parameters for a script file to be run.
402402

403403
-nuget[:restore]
404404
Installs new or updates existing NuGet packages. It is a very close equivalent of dotnet restore command
405+
Note, using nuget directives in the script text aoffers more flexibility (e.g. version support. See cscs -syntax
406+
//css_nuget
405407

406408
-nuget - prints the list of all root packages in the repository
407409
-nuget:restore - Downloads and installs all packages specified in the script without executing the script.
@@ -457,7 +459,7 @@ CS-Script specific syntax
457459
Engine directives:
458460
- //css_include <file>;
459461
- //css_import <file>[, preserve_main][, rename_namespace(<oldName>, <newName>)];
460-
- //css_nuget [-force] [-ver:<version>] package0[,package1]..[,packageN];
462+
- //css_nuget [-force] [-ver:<version>] [-pre|--prerelease] package0[,package1]..[,packageN];
461463
- //css_nuget [-noref] [-force[:delay]] [-ver:<version>] [-rt:<runtime>] [-ng:<nuget arguments>]
462464
package0[,package1]..[,packageN];
463465
- //css_args arg0[,arg1]..[,argN];
@@ -545,18 +547,20 @@ newName - new name of a namespace to be renamed during importing
545547

546548
------------------------------------
547549

548-
//css_nuget [-force] [-ver:<version>] package0[,package1]..[,packageN];
550+
//css_nuget [-force] [-ver:<version>] [-pre|--prerelease] package0[,package1]..[,packageN];
549551

550552
Downloads/Installs the NuGet package. It also automatically references the downloaded package assemblies.
551553
By default, the package is not downloaded again if it was already downloaded.
552554
CS-Script uses dotnet.exe to manage NuGet packages. This makes the developer experience fully consistent with
553555
traditional SW development of compiled .NET applications.
554556

555557
-force - switch to force individual packages downloading even when they were already downloaded.
556-
-ver:<version> - switch to download/reference a specific package version.
558+
<-ver|-v>:<version> - switch to download/reference a specific package version.
559+
-pre|--prerelease - allows prerelease packages to be used.
557560

558561
Examples: //css_nuget cs-script;
559-
//css_nuget -force NLog
562+
//css_nuget -force -pre NLog
563+
//css_nuget -pre Microsoft.SqlServer.SqlManagementObjects, Microsoft.SqlServer.ConnectionInfo
560564

561565
--- Legacy NuGet support ---
562566

src/CSScriptLib/src/CSScriptLib/CSScriptLib.csproj

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1515
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1616
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
17-
<Version>4.10.1.0</Version>
17+
<Version>4.11.0.0</Version>
1818
<Authors>Oleg Shilo</Authors>
1919
<Description>CS-Script engine Class Library for .NET 5 (and higher)</Description>
2020
<Copyright>(C) 2018-2023 Oleg Shilo</Copyright>
@@ -29,15 +29,20 @@
2929
## Changes
3030

3131
### CLI
32-
- WDBG:
33-
- usability updates
32+
- fixed problem with `css -ls &lt;kill-all|ka&gt;`
33+
- Added support for pre-release packages `//css_nuget -pre &lt;package&gt;`
34+
- WDBG:
35+
- Improved tracking of declaration scope
36+
- UX improvements
37+
- Inject dbg metadata is ported to pure Roslyn.
38+
- Detect debug metadata out of sync and report it (2)
3439

3540
### CSScriptLib
36-
- &lt;no changes&gt;</PackageReleaseNotes>
41+
- Added NativeAOT sample</PackageReleaseNotes>
3742
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
38-
<AssemblyVersion>4.10.1.0</AssemblyVersion>
39-
<FileVersion>4.10.1.0</FileVersion>
40-
<PackageVersion>4.10.1.0</PackageVersion>
43+
<AssemblyVersion>4.11.0.0</AssemblyVersion>
44+
<FileVersion>4.11.0.0</FileVersion>
45+
<PackageVersion>4.11.0.0</PackageVersion>
4146
<PackageLicenseExpression>MIT</PackageLicenseExpression>
4247
<PackageIcon>css_logo.png</PackageIcon>
4348
<SignAssembly>True</SignAssembly>

src/CSScriptLib/src/CSScriptLib/Evaluator.CodeDom.cs

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class CodeDomEvaluator : EvaluatorBase<CodeDomEvaluator>, IEvaluator
5858
[Obsolete("Starting from v4.10.0.0 compiling scripts on CS-Script own build server is no " +
5959
"longer recommended as using csc.exe native build server brings the same performance benefits " +
6060
"but without the cost of the custom build server. The default value of this field is also changed " +
61-
"to 'false' for the same reason.")]
61+
"to 'false' for the same reason.", true)]
6262
public static bool CompileOnServer = false;
6363

6464
/// <summary>
@@ -284,65 +284,66 @@ override protected (byte[] asm, byte[] pdb) Compile(string scriptText, string sc
284284

285285
if (Runtime.IsCore)
286286
{
287-
if (CompileOnServer && Globals.BuildServerIsDeployed)
288-
{
289-
var usingCli = false;
290-
/////////////////////
291-
if (usingCli)
292-
{
293-
// using CLI app to send/receive sockets data
294-
295-
// statr server; it will exit if it is already started
296-
dotnet.RunAsync($"\"{Globals.build_server}\" -start -port:{BuildServer.serverPort}");
297-
298-
// send the buld request
299-
cmd = $@"""{Globals.build_server}"" -port:{BuildServer.serverPort} csc {common_args.JoinBy(" ")} /out:""{assembly}"" {refs_args.JoinBy(" ")} {source_args.JoinBy(" ")}";
300-
result.NativeCompilerReturnValue = dotnet.Run(cmd, build_dir, x => result.Output.Add(x));
301-
}
302-
else
303-
{
304-
// using sockets directly
305-
var request = $@"csc {common_args.JoinBy(" ")} /out:""{assembly}"" {refs_args.JoinBy(" ")} {source_args.JoinBy(" ")}"
306-
.SplitCommandLine();
307-
308-
// ensure server running it will gracefully exit if another instance is running
309-
var startBuildServerCommand = $@"""{Globals.build_server}"" -listen -port:{BuildServer.serverPort} -csc:""{Globals.csc}""";
310-
311-
dotnet.RunAsync(startBuildServerCommand);
312-
Thread.Sleep(30);
313-
314-
var response = BuildServer.SendBuildRequest(request, BuildServer.serverPort);
315-
316-
bool buildServerNotRunning() => response.GetLines()
317-
.FirstOrDefault()?
318-
.Contains("System.Net.Internals.SocketExceptionFactory+ExtendedSocketException")
319-
== true;
320-
321-
for (int i = 0; i < 10 && buildServerNotRunning(); i++)
322-
{
323-
Thread.Sleep(100);
324-
response = BuildServer.SendBuildRequest(request, BuildServer.serverPort);
325-
}
326-
327-
if (buildServerNotRunning())
328-
{
329-
throw new CompilerException($"{sdk_warning}CS-Script build server is not running:\n" +
330-
$"Either\n" +
331-
$" - start server from the host application 'CSScript.StartBuildServer();'\n" +
332-
$" - start server manually with 'dotnet {startBuildServerCommand}'\n" +
333-
$" - use RoslynEvaluator\n" +
334-
$" - compile script with CodeDom in the same process (`CodeDomEvaluator.CompileOnServer = false;`)");
335-
}
336-
result.NativeCompilerReturnValue = 0;
337-
result.Output.AddRange(response.GetLines());
338-
}
339-
}
340-
else
341-
{
342-
cmd = $@"""{Globals.csc}"" {common_args.JoinBy(" ")} /out:""{assembly}"" {refs_args.JoinBy(" ")} {source_args.JoinBy(" ")}";
343-
344-
result.NativeCompilerReturnValue = dotnet.Run(cmd, build_dir, x => result.Output.Add(x), x => std_err += x, CodeDomEvaluator.CscTimeout);
345-
}
287+
// should be deleted after the build server is removed v4.11.0+
288+
// if (CompileOnServer && Globals.BuildServerIsDeployed)
289+
// {
290+
// var usingCli = false;
291+
// /////////////////////
292+
// if (usingCli)
293+
// {
294+
// // using CLI app to send/receive sockets data
295+
296+
// // statr server; it will exit if it is already started
297+
// dotnet.RunAsync($"\"{Globals.build_server}\" -start -port:{BuildServer.serverPort}");
298+
299+
// // send the buld request
300+
// cmd = $@"""{Globals.build_server}"" -port:{BuildServer.serverPort} csc {common_args.JoinBy(" ")} /out:""{assembly}"" {refs_args.JoinBy(" ")} {source_args.JoinBy(" ")}";
301+
// result.NativeCompilerReturnValue = dotnet.Run(cmd, build_dir, x => result.Output.Add(x));
302+
// }
303+
// else
304+
// {
305+
// // using sockets directly
306+
// var request = $@"csc {common_args.JoinBy(" ")} /out:""{assembly}"" {refs_args.JoinBy(" ")} {source_args.JoinBy(" ")}"
307+
// .SplitCommandLine();
308+
309+
// // ensure server running it will gracefully exit if another instance is running
310+
// var startBuildServerCommand = $@"""{Globals.build_server}"" -listen -port:{BuildServer.serverPort} -csc:""{Globals.csc}""";
311+
312+
// dotnet.RunAsync(startBuildServerCommand);
313+
// Thread.Sleep(30);
314+
315+
// var response = BuildServer.SendBuildRequest(request, BuildServer.serverPort);
316+
317+
// bool buildServerNotRunning() => response.GetLines()
318+
// .FirstOrDefault()?
319+
// .Contains("System.Net.Internals.SocketExceptionFactory+ExtendedSocketException")
320+
// == true;
321+
322+
// for (int i = 0; i < 10 && buildServerNotRunning(); i++)
323+
// {
324+
// Thread.Sleep(100);
325+
// response = BuildServer.SendBuildRequest(request, BuildServer.serverPort);
326+
// }
327+
328+
// if (buildServerNotRunning())
329+
// {
330+
// throw new CompilerException($"{sdk_warning}CS-Script build server is not running:\n" +
331+
// $"Either\n" +
332+
// $" - start server from the host application 'CSScript.StartBuildServer();'\n" +
333+
// $" - start server manually with 'dotnet {startBuildServerCommand}'\n" +
334+
// $" - use RoslynEvaluator\n" +
335+
// $" - compile script with CodeDom in the same process (`CodeDomEvaluator.CompileOnServer = false;`)");
336+
// }
337+
// result.NativeCompilerReturnValue = 0;
338+
// result.Output.AddRange(response.GetLines());
339+
// }
340+
// }
341+
// else
342+
// {
343+
cmd = $@"""{Globals.csc}"" {common_args.JoinBy(" ")} /out:""{assembly}"" {refs_args.JoinBy(" ")} {source_args.JoinBy(" ")}";
344+
345+
result.NativeCompilerReturnValue = dotnet.Run(cmd, build_dir, x => result.Output.Add(x), x => std_err += x, CodeDomEvaluator.CscTimeout);
346+
// }
346347
}
347348
else
348349
{

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ static void Main(string[] args)
4545

4646
static void Test_CodeDom()
4747
{
48-
CodeDomEvaluator.CompileOnServer = true;
4948
dynamic script = CSScript.CodeDomEvaluator
5049
.LoadMethod(@"public (int, int) func()
5150
{

src/Tests.CSScriptLib/Evaluator.Api.Test.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public API_CodeDom()
2727
{
2828
base.GetEvaluator = () => CSScript.CodeDomEvaluator;
2929
// CSScript.EvaluatorConfig.DebugBuild = true;
30-
CodeDomEvaluator.CompileOnServer = true;
3130
}
3231

3332
[Fact]

src/Tests.CSScriptLib/Evaluator.CodeDom.Test.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public void call_UnloadAssembly()
6666
public void call_LoadMethod()
6767
{
6868
CSScript.EvaluatorConfig.DebugBuild = true;
69-
CodeDomEvaluator.CompileOnServer = true;
7069

7170
dynamic script = CSScript.CodeDomEvaluator
7271
.LoadMethod(@"public object func()

src/Tests.cscs/cli.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,14 @@ public void complex_commands()
372372

373373
// will need to use a different sample script to test the rest of the functionality
374374

375-
output = cscs_run($"{probing_dir} -self-exe");
376-
Assert.Equal($"Created: {cscs_exe.ChangeFileName("css.exe")}", output);
375+
// output = cscs_run($"{probing_dir} -self-exe");
376+
// Assert.Equal($"Created: {cscs_exe.ChangeFileName("css.exe")}", output);
377377

378-
output = cscs_run($"{probing_dir} -self-exe-run");
379-
Assert.Equal($"Created: {cscs_exe.ChangeFileName("css.exe")}", output);
378+
// output = cscs_run($"{probing_dir} -self-exe-run");
379+
// Assert.Equal($"Created: {cscs_exe.ChangeFileName("css.exe")}", output);
380380

381-
output = cscs_run($"{probing_dir} -self-exe-build");
382-
Assert.Equal($"Created: {cscs_exe.ChangeFileName("css.exe")}", output);
381+
// output = cscs_run($"{probing_dir} -self-exe-build");
382+
// Assert.Equal($"Created: {cscs_exe.ChangeFileName("css.exe")}", output);
383383
}
384384
}
385385

src/chocolatey/cs-script.nuspec

Lines changed: 9 additions & 4 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.10.1.0</version>
5+
<version>4.11.0.0</version>
66
<title>CS-Script</title>
77
<authors>Oleg Shilo</authors>
88
<owners>Oleg Shilo</owners>
@@ -29,11 +29,16 @@
2929
## Changes
3030

3131
### CLI
32-
- WDBG:
33-
- usability updates
32+
- fixed problem with `css -ls &lt;kill-all|ka&gt;`
33+
- Added support for pre-release packages `//css_nuget -pre &lt;package&gt;`
34+
- WDBG:
35+
- Improved tracking of declaration scope
36+
- UX improvements
37+
- Inject dbg metadata is ported to pure Roslyn.
38+
- Detect debug metadata out of sync and report it (2)
3439

3540
### CSScriptLib
36-
- &lt;no changes&gt;</releaseNotes>
41+
- Added NativeAOT sample</releaseNotes>
3742
<copyright>Oleg Shilo</copyright>
3843
<tags>cs-script C# script dynamic hosting</tags>
3944
<dependencies>

src/cscs/NuGet.Core.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ public static (string[] assemblies, string[] nativeAssetsDirs) FindAssembliesOf(
628628
var packageVersion = packageArgs.ArgValue("-ver") ?? packageArgs.ArgValue("-v");
629629
packageVersion = packageVersion.IsNotEmpty() ? $"-v {packageVersion} " : "";
630630

631-
var runResult = dotnet_run($"add package {package} {prerelease} -n"); // `-n` is to prevent restoring at this stage as it will be called for the whole project
631+
var runResult = dotnet_run($"add package {package} {prerelease} {packageVersion} -n");// `-n` is to prevent restoring at this stage as it will be called for the whole project
632632

633633
if (runResult.exitCode != 0)
634634
Console.WriteLine($"Cannot add package {package}: {runResult.output}");

src/cscs/cscs.csproj

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<AssemblyName>cscs</AssemblyName>
77
<RootNamespace>CSScripting</RootNamespace>
88
<StartupObject />
9-
<Version>4.10.1.0</Version>
9+
<Version>4.11.0.0</Version>
1010
<Authors>Oleg Shilo</Authors>
1111
<Product>CS-Script</Product>
1212
<Copyright>(C) 2004-2023 Oleg Shilo</Copyright>
@@ -16,18 +16,23 @@
1616
<RepositoryUrl>https://github.com/oleg-shilo/cs-script</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>
1818
<PackageTags>C# script dynamic</PackageTags>
19-
<AssemblyVersion>4.10.1.0</AssemblyVersion>
20-
<FileVersion>4.10.1.0</FileVersion>
19+
<AssemblyVersion>4.11.0.0</AssemblyVersion>
20+
<FileVersion>4.11.0.0</FileVersion>
2121
<PackageReleaseNotes>---
2222

2323
## Changes
2424

2525
### CLI
26-
- WDBG:
27-
- usability updates
26+
- fixed problem with `css -ls &lt;kill-all|ka&gt;`
27+
- Added support for pre-release packages `//css_nuget -pre &lt;package&gt;`
28+
- WDBG:
29+
- Improved tracking of declaration scope
30+
- UX improvements
31+
- Inject dbg metadata is ported to pure Roslyn.
32+
- Detect debug metadata out of sync and report it (2)
2833

2934
### CSScriptLib
30-
- &lt;no changes&gt;</PackageReleaseNotes>
35+
- Added NativeAOT sample</PackageReleaseNotes>
3136
<PackageLicenseExpression>MIT</PackageLicenseExpression>
3237
<PackageIcon>css_logo.png</PackageIcon>
3338
<ApplicationIcon>css_logo.ico</ApplicationIcon>
@@ -94,16 +99,16 @@
9499
<PackageReadmeFile>package_readme.md</PackageReadmeFile>
95100
</PropertyGroup>
96101
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0|AnyCPU'">
97-
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062s</NoWarn>
102+
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062;NU5119</NoWarn>
98103
</PropertyGroup>
99104
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0|AnyCPU'">
100-
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062s</NoWarn>
105+
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062;NU5119</NoWarn>
101106
</PropertyGroup>
102107
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0|AnyCPU'">
103-
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062s</NoWarn>
108+
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062;NU5119</NoWarn>
104109
</PropertyGroup>
105110
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0|AnyCPU'">
106-
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062s</NoWarn>
111+
<NoWarn>CA1701;CA1702;CA1860;IDE0130;IDE0057;CA1829;IDE0062;NU5119</NoWarn>
107112
</PropertyGroup>
108113
<ItemGroup>
109114
<!-- start: nuget tool package custom commands (keep this line here, it is a marker for automation) -->

0 commit comments

Comments
 (0)