• Save
Introduction to Scriptcs
Upcoming SlideShare
Loading in...5

Like this? Share it with your network

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 47

https://twitter.com 47

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. scriptcs.net@scriptcsnetwww.scriptcs.net
  • 2. scriptcs.net@filip_wojgithub.com/filipwwww.strathweb.comwww.arcmedia.ch
  • 3. scriptcs.netWho is scriptcs? Community (!) Coordinators Glenn Block (@glennblock) Justin Rusbatch (@jrusbatch) Filip Wojcieszyn (@filip_woj) Core Commiters Damian Schenkelman (@dschenkelman) Kristian Hellang (@khellang)
  • 4. scriptcs.netMetrics 525 watchers 110 forks 142 pull requests 29 unique contributors 14 community contributed script packs (extensions) Currently at v0.5
  • 5. scriptcs.netKhalid AbuhakmehIan Battersby Nick Berardi Glenn Block Scott Blomquist Danielle Boldt Tim EricksonJonas Follesø Victor Grigoriu Andreas Håkansson Kristian Hellang lbargaoanu Denis Mentey JohnNelson Alexander Nyquist David Pendray Aaron Powell Adam Ralph Justin Rusbatch DamianSchenkleman Paul Shmakov Lodewijk Sioen Brandon Stirnaman Paul Stovell Patrik Svensson KevinTrethewey Michael Wade Filip Wojcieszyn Matt WrockContributors
  • 6. scriptcs.netWhat is scriptcs? OSS project enabling rich C# scripting experience Script and execute -or- use REPL Robust extensibility model Low ceremony, lightweight Use your favorite text editor No compilation/projects/solutions Built on top of Nuget & Roslyn (no hard dependencies)
  • 7. scriptcs.net
  • 8. scriptcs.netScriptcs overviewscriptcsScript EnginePackageManagementScript Packs
  • 9. scriptcs.netKey scriptcs features Relaxed C# syntax & code semantics As defined in “Interactive C#/VB REPL and Script - CodeSemantics Spec“ white paper REPL Node.js-like extensibility model (script packs) Debug & step through in Visual Studio Sublime text plugin Scriptcs.Core available as a hostable service Nuget integration
  • 10. scriptcs.netScriptcs modelRoslyn / Mono.Csharp*NugetOSS libraries MEF
  • 11. scriptcs.netOSS libraries used by scriptcs Autofac (dependency injection) Common Logging, log4net (logging) LiteGuard (argument checks) Nuget Core (package installation as a service) PowerArgs (command line parsing) ServiceStack.Text (serialization) Moq, xunit, Should (testing)
  • 12. scriptcs.netGetting started with scriptGetpackages*• Scriptcs -installWritecode• Any editorExecute • CLI or hosted
  • 13. scriptcs.netDemo: Getting started with script
  • 14. scriptcs.netDemo: #load & #r
  • 15. scriptcs.netGetting started with REPLGetpackages*• Scriptcs -installRunscriptcsWritecodeEvaluate
  • 16. scriptcs.netDemo: Getting started - REPL
  • 17. scriptcs.net
  • 18. scriptcs.netScript code semantics No top level class No arbitrary namespaces No Main method Global functions allowed Script packs accessible through Require<T> #load directive to load script from script #r directive to reference an assembly from script
  • 19. scriptcs.net
  • 20. scriptcs.netTypical C# experience Start Visual Studio (...wait...) Choose VS project template Create new solution Add references, install Nuget packages, importnamespaces Compile Run (repeat: compile+run) Difficult to distribute source code (bloated)
  • 21. scriptcs.net
  • 22. scriptcs.netTypical scriptcs experience Install Nuget packages with “scriptcs –install” Write code in any text editor Run (repeat: edit & run) Easy to distribute code (just CSX + packages.config)
  • 23. scriptcs.netSelf hosted server – traditional C#
  • 24. scriptcs.netSelf hosted server – scriptcs / node.js
  • 25. scriptcs.netDemo: Nancy
  • 26. scriptcs.netRole of script packsImport referencesImport namespacesExpose functionality
  • 27. scriptcs.netScript pack example: NUnit References nunit.core.dll, nunit.core.interfaces.dll, nunit.framework.dll Namespaces Nunit.Framework, System.Reflection Functionality public TestResult RunAllUnitTests(Assembly testAssembly =null) public TestResult RunAllUnitTests(Action<string> callback,Assembly testAssembly = null)
  • 28. scriptcs.netscriptcs Nuget integration Developed to work around nuget.exe limitations scriptcs –install Gets all packages from packages.config with dependencies scriptcs –install <package name> Gets specific package with dependencies scriptcs –save Creates packages.config based on packages folder scriptcs –clean Gets rid of packages folder and unnecessary binaries
  • 29. scriptcs.netDemo: RavenDB
  • 30. scriptcs.netDemo: P/Invoke
  • 31. scriptcs.netDemo: WPF
  • 32. scriptcs.netGet scriptcs CLI distributed via Chocolatey cinst scriptcs Libs available on Nuget Nightly builds on MyGet Build from source github.com/scriptcs
  • 33. scriptcs.netWhat’s next? Pluggable CLI commands Pluggable REPL commands Export to Visual Studio solution Mono support Script packs as scripts ScriptCatalog – extend applications (MEF) with scriptcs Improved ScriptCs.Core API
  • 34. scriptcs.net