Release v3.25.3.0
Use choco install cs-script
to deploy the release (instructions on how to use/enable choco).
If you prefer manual install then avoid using WinZip or WinRar as they lead to locking the downloaded content. Use 7zip instead.
Extension Pack
contains some additional content representing somewhat less mainstream functionality and experimental features. For installing it extract cs-script.ExtensionPack.7z
archive to your install location (e.g. C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script).
- Added support for resolving NuGet packages from the
netstandard
lib subfolders - Added defaultRefAssemblies exchange in InitExecuteOptions()
- .NET Core support (RC)
- Issue #61: Issues with caching; Sample:
CSScript.GlobalSettings.LegacyTimestampCaching = false;
(default isfalse
) - Added support for
//css_ac_end
to allow Extension methods in classless scripts - Implemented caching for InMemory script assemblies
- Fixed collapsing spaces in the DefaulrRefAssemblies settings value
The most important features of this release are
.NET Core - Release Candidate
The CS-Script functionality for .NET Core is bound to (defined by) the scope of the currently implemented Reflection namespace found in .NET Core. Thus some CS-Script features are not ported yet. They will be as soon as .NET Core completes and releases currently missing functionality.
The full set of supported features is presented in this test code.
The binary will be published on NuGet soon.
Changes in the script caching/timestamping algorithm.
Prompted by Issue #61 CS-Script timestamp-based caching algorithm has been updated to avoid modifying compiled assemblies LastModifiedTime file attribute. Now the timestamp is injected in the assembly cs-script metadata instead of being saved as a file attribute. If for whatever reason the old believer is required you can always re-enable it as follows:
CSScript.GlobalSettings.LegacyTimestampCaching = false;
Alternatively you can set CSS_LEGACY_TIMESTAMP_CACHING
environment variable to true
.
Support for extension methods in classless scripts
Before this release it was impossible to have extension methods in the classless scripts due to the fact that the whole script code is wrapped in the on-fly class definition. Thus none of the extension methods from the classless script can be in a top-level class definitions but rather a nested class definition instead. This causes a compile error for the obvious reason.
space
To avoid this limitation a special directive //css_ac_end
has been introduced. This directive indicates the end of the auto-class (classless) script so the runtime stops decorating any code after that directive.
//css_args -ac
using System;
void main()
{
Console.WriteLine("\textension\ttest".TabToSpaces());
}
//css_ac_end
static class Extensions
{
public static string TabToSpaces(this string text, string replacement = " ")
{
return text.Replace("\t", replacement);
}
}