CS-Script 3.20.0

Script Aliases


Script alias is a script file which does not contain any C# code but only information about the actual C# script file to be invoked.  Script alias is a logical equivalent of a file shortcut on Windows. The analogy with Windows shortcuts is nearly perfect as you can specify the command line arguments and even point to another alias instead of the actual script file:

SayHelloNow.cs (script alias)
//css_include SayHello.cs;
//css_args "Hello there!";

SayHello.cs (script alias)
//css_include Hello.cs;

Hello.cs (actual script)
using System;
using System.Windows.Forms;

class Script
{
    static public void Main(string[] args)
    {
        if (args.Length > 0)
            MessageBox.Show(args[0]);
        else
            MessageBox.Show("<empty>");
    }
}

You can use .csl file extension to distinguish between the scripts and script aliases, however it is entirely optional.

Using script aliases can be useful when you want to introduce a new naming identity for the already existing script.  CS-Script is distributed with the debugVS8.0.cs script for debugging scripts in VisualStudio 8.0 (VS2005). To make development more convenient, CS-Script distribution also includes Lib/Debug2005.csl which is nothing else but an alias to the debugVS8.0.cs

Lib/Debug2005.csl
//css_include debugVS8.0.cs;

It meas that if you want to run debugVS8.0.cs script you can execute the following command in the command prompt:
 cscs debug2005
Script aliases can also be used as a fixed collection of assembly references and importable scripts. For example, if you have a number of Interop assemblies to work with the MS Office products you can combine corresponding references into a single file and use it as a single "include statement" from your client script.

MSOffice.cs (script alias)
//css_ref interop.Word.dll;
//css_ref interop.PowerPoint.dll;
//css_ref interop.Access.dll;
//css_ref interop.Excel.dll;

CreateSpreadseet.cs (client script)
//css_inc MSOffice.cs;
using System;

class Script

    static public void Main(string[] args)
    {
        .....



See Also

Using .NET assembliesScript Library | Importing scripts