The .NET platform has always been a mainstay of the desktop and server app development field, powering Windows Forms, WPF, ASP.NET, and many years of Line of Business (LOB) apps. Today, however, .NET is a very different platform; it's powered by an open-source API-based compiler platform, features in-built scripting capabilities, and C# can be authored effectively in many IDEs, not just from Microsoft.
Thanks to these changes, there's been rapid growth in innovative and unconventional uses for C# and the whole .NET platform. Let's check out five of the most exciting projects:
1. scriptcs: scriptcs makes it easy to write and execute C# with a simple text editor.
scriptcs is one of the older projects on this list and one of the pioneers of IDE-free C#. scriptcs allows you to write simple, low-ceremony scripts using C# and your favorite text editor on Windows. Scripts have drastically simplified syntax compared to "traditional" C# apps and can be as simple as one-line C# snippets, or can use "script packs" to build a functioning ASP.NET Web API endpoint in just 10 lines of code. Plus, with support for referencing assemblies and installing packages out of the box, scriptcs lets you leverage the huge ecosystem of NuGet packages available, right in your scripts.
2. Cake: Cake (C# Make) is a cross-platform build-automation system with a C# DSL.
Cake is a cross-platform project for writing build-automation scripts in C# to do things such as compiling code, running tests, building packages, or just about anything else. Built on the Roslyn and Mono compilers, Cake lets you write your build scripts in C# and run them directly on Linux, Windows, and Mac OS, locally or on any CI platform of choice. With more than 100 community add-ins, Cake has support for everything from cloud storage, orchestration and messaging, to controlling containers, virtual machines, and web servers.
3. ConfigR: Write your .NET configuration files in C#.
ConfigR is another Roslyn compiler-powered extension of the C# language, using a simple and flexible domain-specific language (DSL) to replace static configuration files (XML or JSON, for example) with C# code files. This allows not only for a simple and flexible configuration for .NET apps, but also allows for complex, nested, statically typed configuration that plugs right into your code, no XML needed. Because ConfigR is built on Roslyn, it also allows for referencing external assemblies and scripts so you even can share common configuration logic or retrieve configuration values from a remote server, all from one .csx file.
4. Wyam: Wyam is a highly modular and extremely configurable static content generator and toolkit.
Wyam is an incredibly flexible static content toolkit powered by C# and the Roslyn compiler. Wyam can be used to generate anything from static websites, to online documentation, to complete blogs, and the engine behind Wyam even can be embedded in other .NET applications. The toolkit supports a wide range of technologies and formats, including common .NET technologies (like Razor templates), but also external types, such as Markdown, LESS styles, YAML parsing, and a built-in web server. Powering all of this flexibility, Wyam's configuration file is actually a fully featured C# script, complete with support for external add-ins and modules, classes, and anything else you can do in C#.
5. Scripty: Tools to let you use Roslyn-powered C# scripts for code generation.
Pushing .NET into the realm of metaprogramming, Scripty is a cool project that uses C# scripts to generate C# code. Scripty, like the other projects here, is powered by the Roslyn compiler's scripting support, modified to create C# scripts that can be used for all kinds of code generation, so you can use C# to generate more C#. Because it's project- and compiler-aware, you can also build code-generation scripts to modify your project, generate app code based on existing files and logic, or even use scripts to embed resources in your compiled assets ready for deployment.