Write C# apps with a text editor, nuget and the power of Rosyln!
Note: Roslyn 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] (http://codebetter.com/glennblock/2013/02/28/scriptcs-living-on-the-edge-in-c-without-a-project-on-the-wings-of-roslyn-and-nuget/)
- Check out our goals and rodmap [here] (https://github.com/scriptcs/scriptcs/wiki/Project-goals-and-roadmap)
- Install scriptcs from Chocolatey
cinst scriptcs
or - Build the project from the source and put
scriptcs.exe
in your path.
- Open a cmd prompt as admin
- run
scriptcs -install scriptcs.webapi
- create a
server.csx
with your favorite editor. Paste the text below into the file and save (notice no namespaces & no top level class).
public class TestController : ApiController {
public string Get() {
return "Hello world!";
}
}
var webApi = Require<WebApi>();
var server = webApi.CreateServer("http://localhost:8080");
server.OpenAsync().Wait();
Console.WriteLine("Listening...");
Console.ReadKey();
server.CloseAsync().Wait();
- run
scriptcs server.csx
This will launch a web api host with a sample controller, which you can access from the browser.
scriptcs relies on Roslyn for loading loose C# script files. It will automatically discover nuget packages local to the app and load the binaries.
- Read our Contribution Guidelines.
- List of all contributors to date. Thanks!
- 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.
- Glenn Block (@gblock)
- Justin Rusbatch (@jrusbatch)
- Filip Wojcieszyn (@filip_woj)
Want to chat? In addition to Twitter, you can find us on Google Groups and JabbR!