{{announcement.body}}
{{announcement.title}}

Presenting the SPCoder Application

DZone 's Guide to

Presenting the SPCoder Application

SPCoder is a desktop application for writing and executing C# code without the need for a tool like Visual Studio.

· Open Source Zone ·
Free Resource

SPCoder is a desktop application for writing and executing C# code without the need for a tool like Visual Studio. It uses Roslyn for analysis and execution of the C# code.

The whole idea behind the SPCoder was to create an environment where you could write and execute code and also have different helpful modules for working with data. The application is extensible using so-called autorun scripts, plugins and connectors. So, you can write a C# script and make it a part of the application.

Connectors

There are several connectors available, so you can get the data from:

  • Filesystem.
  • Web page.
  • Public GitHub repository.
  • SharePoint online site.
  • SharePoint on-premise site. 

You could also write a connector for any other data source, that offers an API (e.g. you could write a facebook connector using fb .net sdk so you could write c# code to get a list of your facebook friends, posts, images, etc.)

Code Execution

SPCoder supports the execution of C# expressions. That means you can write something like this: Console.WriteLine("Hello world") select it and press F5 on Keyboard or click the Execute button, and it will write the string Hello world to the output window, without the need for creating a class and Main() method. It also supports all the other features of C# language, so you can create classes, instantiate objects, call methods, invoke delegates, etc. 

SPCoder supporting execution of c# expressions

SPCoder Main Window

SPCoder’s main window contains the main menu, a toolbar with action buttons, and serves as a Multiple-document interface (MDI) parent to several other windows that are arranged in dockable style, similar to Visual Studio. Every window’s position can be set to auto-hide or pinned to any side of the main window.

SPCoder main window

Windows

SPCoder serves as parent to several MDI windows, which are described in GitHub wiki documentation:

  • Autorun scripts.
  • Code editor.
  • Describer.
  • Grid viewer.
  • Explorer.
  • Log window.
  • Output window.
  • Properties viewer.
  • Context window.

SPCoder.RunnerApp

In SPCoder, you can write C# code and execute it in real time, interactively. In case you need to run some C# code without a GUI, you can use the SPCoder.RunnerApp console application. This application is useful in situations when you need to run code as a scheduled task/azure web job. You don't need to compile the code in order to be able to run it. You just need to save your code in one or more .csx files and tell the SPCoder.RunnerApp where the code is. 

Configuration

SPCoder.RunnerApp.exe is a console application. When it starts it will look for the Code\init.csx file and try to execute the code from it using Roslyn.

The path to the default .csx file can be changed in SPCoder.RunnerApp.exe.config file, by changing the CodePath parameter:

HTML
 




x


1
<appSettings>    
2
    <add key="CodePath" value="Code\init.csx" /> 
3
</appSettings>



Resources

SPCoder application is open source. You can download the source code and build it yourself or download the zip package with binaries.

Github repo: https://github.com/tomdam/spcoder
Documentation: https://github.com/tomdam/spcoder/wiki
Interesting example, that shows how multiple connectors can be used together: https://github.com/tomdam/spcoder/wiki/Corona-example

Topics:
c#, ide, roslyn, spcoder

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}