This patch release fixes a bug with NuGet that was causing .NET Standard packages to get installed for .NET 4.5 framework assemblies.
This is the first release in a while for scriptcs. It includes some great new features such as Pretty Printing, Support for NuGet credentials, enrichment to the execution environment and more!
For API users (hosting or other programmatic usage), there is one major change, the removal of members exposing Common.Logging types (#1189) from the public API. These were deprecated in version 0.15.0. As a result, the ScriptCs.Core NuGet package no longer takes a dependency on the Common.Logging package.
Breaking API Changes
High impact: Common.Logging types have been removed from the scriptcs public API.
Medium impact: The ScriptCs.Core NuGet package no longer takes a dependency on the Common.Logging package. If you are using Common.Logging for other purposes, after upgrading your project to ScriptCs.Core 0.17.0 you should check to see if NuGet has removed Common.Logging. If so, you will have to reinstall it yourself.
Affects hosters / module authors only
IConsoleinterface has a new
IScriptEnvironmentinterface has new members
FilePreProcessResultclasses have a new member:
- Common Logging is gone! (#1190) - by @glennblock. Kudos to @adamralph for getting everything in place to allow the surgical removal.
- Pretty printing support has now been added to the REPL (#1156) - by @gregoryyoung
![screen shot 2017-02-11 at 10 46 24 pm] (https://cloud.githubusercontent.com/assets/141124/22864844/8de41d34-f10d-11e6-9f9a-5091f5a42812.png)
You can access the compiled script assembly from within a script using the new
Env.ScriptAssemblyproperty. This alleviates having to use reflection or jump through hoops to get the script assembly (#244) - by @glennblock
#load child.csx Console.WriteLine("Main script:" + Env.ScriptPath); Console.WriteLine("Loaded scripts:"); Console.WriteLine("\t" + String.Join(Environment.NewLine + "\t", Env.LoadedScripts.ToArray())); Console.WriteLine("Assembly:" + Env.ScriptAssembly);
Added a ScriptCs Nuget package which has all the binaries. This allows running scripts like on a CI server simply by installing the package from NuGet. Also makes it easy to include ScriptCs binaries in a project. (#1061) - by @glennblock
This hotfix addresses an issue we found with the
ScriptCs.Engine.Roslyn module that affects hosters of scriptcs who are using that package.
The issue does not affect direct users of scriptcs, so it is not necessary to upgrade unless you are hosting.
0.16.0 is here!
This release brings a MAJOR upgrade to scriptcs.
The most prominent feature is we've upgraded to newer Roslyn
1.0.0-rc2 bits! This is a big deal as we've been on the same bits for 3+ years and this brings some major enhancements. The new Roslyn finally brings async/await and dynamic to scripts running on .NET. Not only that, it includes awesome new language enhancements of C# 6.0, like Auto-Property initializers!
Note - We are updating to Roslyn
1.0.0-rc2 and not the latest Roslyn
1.2.1 as the newer bits require .NET 4.6+ and this allows us to keep .NET 4.5 compat.
Look below and see dynamic and Auto-Property initializers in action (On Windows)!
And here is an example using async/await!
REPL enhancements from Mono
This release includes enhancements in our REPL to make it behave similar to the Bash shell. This includes Emacs keybindings, history, searching, etc. Special thanks to @migueldeicaza for this contribution.
Below you can see I have pressed
ctrl+R to use reverse-search to find the code that I had entered with
a. As it is reverse it found the last line that I had entered.
Debugging in Visual Studio
A long sought after feature for scriptcs has been to enable debugging in Visual Studio. In this release we introduce the
:openvs command. From the repl, you can type
:openvs "[filename]" and it will create a solution for you including all the files and subdirectories in the same folder. It will then launch Visual Studio where you can execute the script and debug! You can add breakpoints, watches, etc.
Below you can see a screenshot:
Breaking API Changes
Low Impact - The
IConsole.ReadLine method signature has changed to
string ReadLine(string prompt). This was necessary to properly support the latest REPL enhancements. This change will impact custom hosters who have provided their own
IConsole implementation and it will need to get updated to support the new signature.
Fixed: Cannot use array initializers #1070
Fixed: Error on double handling in REPL #864
Fixed: Support the
dynamic keyword in the Roslyn engine #1057
Fixed: v0.9.0 - Using Generic Method Call Results In "ERROR: Unable to change after type..." #580
Fixed: Stack overflow in Roslyn when local variable is used before declared #691
Fixed: Cannot call external methods with params args #1066
Fixed: Change cache folder to being script-local #1086
Fixed: NullReferenceException running script (x86 Win10, .NET 4.6) #1095
Fixed: Compilation error using dynamic #1110
Fixed: scriptcs -install gives a very verbose error for package not found #1114
Thanks to our contributors!!!
Thank you to the following people outside of our core team who contributed filing issues and sending PRs to this release:
Thanks to Microsoft and the Roslyn team!
This release would not have been possible without the support of the Roslyn team and their awesome move of releasing Roslyn under OSS!
Look for an update in the future that will move on to the latest Roslyn bits!
This release, our first for a while, introduces a new
:scriptpacks REPL command, fixes a bug which prevented
else from being used in Mono and many other small enhancements, bug fixes and performance improvements as well as a significant API change. See 'Issue Details' below for more details.
For API users (hosting or other programmatic usage), there is one major change, the deprecation of Common.Logging (#847). This has been replaced by LibLog, but this is an internal implementation detail, since LibLog is a source code package. The end effect for scriptcs API users is that the members which use Common.Logging types have been obsoleted in the public API and replaced with new members which use types under the
ScriptCs.Contracts namespace. Support for the Common.Logging types will be removed completely in a later release and the dependency on Common.Logging will be removed entirely, so you are encouraged to switch to the new API as soon as possible.
All script packs, script libraries, modules, hosts and other code which uses the scriptcs NuGet packages should be changed to switch from using the Common.Logging members to the new API members as soon as possible to prevent breakage when Common.Logging is removed. For more details, see the related blog post.
For users of ScriptCs.Hosting there is also a further minor change to make the API a little more friendly (#998).
Breaking API Changes
Low impact: The
ScriptCs.Hosting.IScriptServicesBuilder interface has a new method,
LoadScriptPacks(bool load = true). Given there is little utility for API users in implementing this interface, it is extremely unlikely that this will cause any breakages. Indeed, this interface may even be removed in future.
New: Added :scriptpacks REPL command #1005
New: Print exception stack traces to console when logging at debug level #987
New: Warn on scriptcs -save when packages directory does not exist #989
New: Better console output when script not found #1010
New: Show logger name at debug and trace level #1008
New: Update to Mono.CSharp 4.0.0 and NRefactory 5.5.1 #1046
New: Upgrade to NuGet 2.8.6 #1072
New (API): Deprecate Common.Logging usage in favour of our own logging API #847
New (API): Add LoadScriptPacks method to ScriptServicesBuilder #998 (breaking - see above)
New (API): Make ScriptExecutor references methods virtual #1036
else keyword not correctly parsed in Mono #1060
Fixed: Namespaces and references are not properly imported within Script Libraries #1025
Fixed: scriptcs -debug without -repl does not configure REPL correctly. #990
Fixed: Namespace aliasing causes an exception to be thrown #826
Fixed: Script pack usings don't appear in :usings #992
Fixed: Command alias not shown in :help #985
Fixed: Extra line breaks in scriptcs -help #962
Get it on Chocolatey!
For more information see the blog!
New: Script Libraries #909
New: Remove redundant $id from JSON strings in REPL #700
New: Add an ":exit" command to the REPL. #427
New: Ignore shebang on *nix platforms #956
New: Include binstub for *nix in build artifacts #675
New: Better REPL greeting message #932
Fixed: Duplicate references cause script execution to fail #953
Performance: Only scan for modules when -m is specified #964