What is it?

In one sentence, XSharper is a framework and scripting language for writing Windows console and simple GUI applications quickly, with or without Visual Studio.

But it's actually many things at once:

Parts of XSharper can be used as independent source code files too. For some, an extensive description exist:

There are many other pieces in XSharper source code that can be used without creating a dependency on the whole XSharper.Core assembly.

Compared to other tools

XSharper development was inspired by many different tools and frameworks, from ASP.NET to parts of Windows Workflow Foundation, from Microsoft Build XML projects to special scripting languages like Microsoft PowerShell.

In many ways XSharper is to Windows console applications what is ASP.NET to Web applications. It's a framework that consists of multiple simple classes, from parsing user input to downloading files, from formatting output to evaluating expressions and executing SQL, that boost productivity considerably.

Certain frequent operations may be combined into actions, that may be further glued together with XML, producing a simple language where programs can be written without any C# code, not unlike ASP.NET or MS Build scripts. Like ASP.NET, XSharper program using XML syntax may be interpreted or converted to C# source code or .EXE file in a single step, and even back from .EXE to XML. Because it's a framework, it's also possible to glue XSharper actions and classes with PowerShell, Visual Basic, or any other .NET programming language.

As XSharper can also be used as a general purpose scripting language, it may be also compared to Microsoft PowerShell. Both PowerShell and XSharper are languages, and both can be used to replace Windows batch files, producing more readable and more reliable code. There are, however, important differences:

  • PowerShell is primarily a shell for non-programmers to automate administrative tasks on one or multiple computers. As a scripting language, it's a powerful language with its own unique syntax. An explicit installation is required on XP/Vista/Windows 2003/Windows 2008 machines. Even though it is free, it is not open source, and is not redistributable either, so using PowerShell scripts adds prerequisites to your application.
  • XSharper is open source, free, redistributable, and requires no installation or administrative rights. .NET 2.0 installed is the only prerequisite. Even XSharper itself is not required, as any script can be compiled into .exe file easily. And Powershell scripts can be run from XSharper too:
    <include  from="#/powershell.xsh" withTypes="true" />
    <powershell>
    	$dirs = dir 
    	$dirs[0..3] | Write-Host
    </powershell>
    

A little example

If you know C#, using XSharper is as simple as

<% Console.WriteLine("Hello, World!") %>

Below, for example, is a screenshot XSharper console program ("demo"), which prints some text, its own source code, runs some C# code, then DIR command. All that is executed from another XSharper console program (gui-console, available in Library) as

C:\>XSharper #/gui-console.xsh demo.xsh

Demo screenshotDemo screenshot

There are many other examples in Library.