Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Write C# apps with a text editor, nuget and the power of Roslyn!
C# Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.nuget
build
common
docs
src
test
tools/xunit
.gitattributes
.gitignore
CONTRIBUTING.md
LICENSE.md
README.md
ScriptCs.sln
build.cmd

README.md

scriptcs

Why should you care?

Write C# apps with a text editor, nuget and the power of Rosyln!

Note: Rosyln is a pre-release CTP and currently an unsupported technology. As such there may be changes in Roslyn itself that could impact this project. Please bear that in mind when using scriptcs

  • More on why I developed this here
  • Check out our goals and rodmap here

Pre-reqs

Quick start

  • Open a cmd prompt as admin
  • Create a directory "c:\scriptcs_hello" and change to it.
  • run "nuget install Microsoft.AspNet.WebApi.SelfHost -o Packages"
  • create a server.csx with your favorite editor. Paste the text below into the file and save.
using System;
using System.IO;
using System.Web.Http;
using System.Web.Http.SelfHost;

var address = "http://localhost:8080";
var conf = new HttpSelfHostConfiguration(new Uri(address));
conf.Routes.MapHttpRoute(name: "DefaultApi",
   routeTemplate: "api/{controller}/{id}",
   defaults: new { id = RouteParameter.Optional }
);

var server = new HttpSelfHostServer(conf);
server.OpenAsync().Wait();
Console.WriteLine("Listening...");
Console.ReadKey();
  • run "scriptcs server.csx"

This will launch a web api host.

How it works

scriptcs relies on Rosyln for loading loose C# script files. It will automatically discover nuget packages local to the app and load the binaries.

Docs

What's next

  • Adding support for pluggable recipe "packs" for different frameworks.

Contributing

Credits

  • Special thanks to @filip_woj for being the inspiration behind this with his Roslyn Web API posts.
  • Thanks to the Roslyn team who helped point me in the right direction.

Coordinators

Community

Want to chat? In addition to Twitter, you can find us on Google Groups and JabbR!

License

Apache 2 License

Something went wrong with that request. Please try again.