Browsing posts in: scriptcs

Adding C# Scripting to Your Development Arsenal

As part of my efforts to popularize C# scripting in the .NET community (which, hopefully, you have noticed by following this blog, my Twitter or my Github) and in celebration of the first stable release of Roslyn scripting packages on Nuget yesterday, I published a guest post at Canadian Developer Connection blog – Adding C# Scripting to Your Development Arsenal.

You can read the post here, and hopefully you find it useful. It’s part 1 of a short 2-piece series.

Running C# scripts and snippets in Visual Studio Code with scriptcs

Recently Microsoft open sourced the Code editor and I think a lot of people would agree that it’s really awesome. The UI based on Electron and the Monaco editor previously used in Visual Studio Online is really snappy and works great.

Visual Studio Code can also now be extended via plugins – and when that was announced, I thought why not make something for scriptcs? There already is a scriptcs plugin for Sublime Text and for Atom, so it only makes sense to have one for Visual Studio Code.

Continue Reading

Running a C# REPL in a DNX application with scriptcs

One of the cool things that scriptcs allows you to do, is that you can embed it into your application and allow execution of C# scripts. There are even some great resources on that out there, like this awesome post by Mads.

The same applies to the REPL functionality – you don’t have to use scriptcs.exe to access the REPL – you can use the scriptcs Nuget packages to create a REPL inside your app.

And because there aren’t that many resources (if any) on how to host a scriptcs REPL, today I wanted to show you just that. But for a more interesting twist, we’ll do that inside a DNX application.

There are many reasons why DNX is awesome, and why you’d want to use it, but especially because, through the project.json project system, it has a much improved way of referencing and loading dependencies and Nuget packages – and we can leverage that mechanism to feed assemblies into our REPL.

Continue Reading

Hacking DNX to run C# scripts

Because of my considerable community involvement in promoting C# scripting (i.e. here or here), I thought the other day, why not attempt to run C# scripts using DNX?

While out of the box, DNX only compiles proper, traditional C# only, thanks to the compilation hooks it exposes, it is possible to intercept the compilation object prior to it being actually emitted, which allows you to do just about anything – including run C# scripts.

Let’s explore more.

Continue Reading

Scriptcs gets new REPL commands and is now better than ever

Yesterday the scriptcs project got an little injection of awesomeness through a set of new REPL commands we have added. You can now conveniently access a bunch of contextual information about your REPL session – the idea is to make your work with the REPL smoother, more productive and, of course, more enjoyable. Let’s quickly walk through them in this post.

By the way, it’s a good moment to remind that the REPL command infrastructure is fully extensible – so you can easily build up your own commands. Watch my talk from NDC Oslo if you are interested, there is an example in there.

Continue Reading

Using ConfigR as a Configuration Source in ASP.NET vNext

One of the cool things about ASP.NET vNext is that it introudces a configuration abstraction, Microsoft.Framework.ConfigurationModel over your application’s configuration.

This is going to replace the old school, limiting approach of forcing you to work with XML configuration only through the System.Configuration classes.

Louis DeJardin has blogged about the ideas behind the isolation of Configuration in his blog post. In the meantime, let’s have a look at how we could enable a ConfigR-based configuration too.

Continue Reading

Easier Redis development with scriptcs and ServiceStack.Redis powered C# REPL

In my current project I am working a lot with Redis on the back end. What I have found extremely useful is the ability to work with Redis directly from its REPL (redis-cli), to instantly check or reset the objects stored there.

However, working in the C# environment, the basic redis-cli is definitely not enough to facilitate productive development.

Enter scriptcs.

Continue Reading

Extend Glimpse on the fly – scriptcs code execution tab in Glimpse

In scriptcs, one of the things we have been paying lots of attention to recently, is the hosting story. Scriptcs CLI is simply just one of the clients using the core scriptcs libraries – which can be used to embed the rich scriptcs code parsing and execution capabilities in any app.

This weekend I put together a small Glimpse plugin which uses scriptcs hosting, and can be used for executing arbitrary code against the context of your ASP.NET application.

More after the jump.

Continue Reading

Scriptcs and multiline REPL!

A while ago, we added a killer REPL feature to the scriptcs project. Recently, we followed it up with adding support for one of the most popular requested features – multiline constructs for the REPL.

It’s not yet available in the stable version available via Chocolatey or on the master branch on Github, but you can get a taste of how it looks and feels by installing the nightly build or building from dev branch directly.

Let’s have a quick look together.

Continue Reading