Category Archives: roslyn

March, 2013

Leveraging Roslyn to author ASP.NET Web API without recompiling

Some time ago I posted a mini-series of posts about using Roslyn to script Web API, and that has gotten some great response. In that original post, I mentioned & used, without going into too much details, a very useful “compiler as a service” feature Roslyn offers.

Recently, Glenn Block started a very exciting project called scriptcs (which now Justin Rusbtach and I happen to be a part of too) to provide a seamless/node.js-esque scripting experience for C# and in that project we indeed leverage on Roslyn heavily – to do some behind the scenes tricks to hide the compilation aspect from the user, so that it really resembles pure script execution.

Continue reading

February, 2013

Building Web API Visual Studio support tools with Roslyn

Because Roslyn is amazing

In my humble opinion, Microsoft Roslyn is one of the most exciting things on the .NET stack. One of the many (MANY) things you can do easily with Roslyn, is write your own development-time code analysis tools.

We have talked about Roslyn scripting capabilities on this blog before (twice actually). Let’s look at code analysis today and see how we could built tools that could help Web API developers build nice clean HTTP services.

More after the jump.

Continue reading

October, 2012

Scripting Web API self host with Roslyn CTP – Part 2

Because you can build your own interactive compiler/parser

This is part two of the series – if you haven’t read part one check it out before proceeding.

Last time we did some cool stuff with using C# script files to instantiate a working Web API server – by executing them with RCSI and C# interactive window.

In part two, let’s use Roslyn to build our own scripting application (custom C# console), which will act as an input window for the user; user will be able type C# code that’s supposed to be executed and run it (something that services such as Compilify offer). We will expose Web API assemblies in that context, allowing the user to type in the code required for the Web API server to be run.

More after the jump.

Continue reading

September, 2012

Scripting Web API self host with Roslyn CTP – Part 1

Because with Roslyn you can do stuff you didn't even dream about

If you follow me on Twitter you probably already know that recently I’ve been playing around with Roslyn. If you don’t know about Roslyn, in very short, you can think of it as “compiler as a service”.

There is a whole plethora of stuff that Roslyn allows us to do, one of the coolest being the scripting API – enabling us to use C# as a script language (think i.e. Perl or Python). So I had this idea, why not script a fully functional web server through Web API self host?

More after the jump.

Continue reading