DotNetScript
Jump to navigation
Jump to search
Contents
Introduction
DotNetScript is an XML container that describes how to compile source code from any .NET language, so it may be Just-in-Time compiled and executed. This can be used with the LavishScript command RunScript when used in Inner Space, to run .NET source code as if it were any other script. This is in addition to the existing .NET functionality in Inner Space that allows execution of .NET assemblies.
Child Elements
- Language
- The .NET language the "script" is written in. Any .NET language that exposes a CodeDomProvider may be used, and any name supported by CodeDomProvider.CreateProvider may be used to identify the language. For example, C# may be referred to as C#, cs, or csharp. Capitalization is not important.
- SourceFiles
- List of source files. Relative paths are relative to the location of the file containing the DotNetScript. For example, if C:\Program Files\InnerSpace\Scripts\MyScript.XML contains the DotNetScript, then a source file identified as "MyScript\MyScript.cs" will resolve to C:\Program Files\InnerSpace\Scripts\MyScript\MyScript.cs. Each source file must be within a <string> tag.
- MainClass
- The application's "main class". This is optional.
- References
- List of assembly references, such as Lavish.InnerSpace.dll. Each reference must be within a <string> tag.
- EmbeddedResources
- The list of resource files to embed (e.g. images, sounds, etc). Relative paths are relative to the location of the file containing the DotNetScript (see SourceFiles above for further explanation). Each resource file must be within a <string> tag.
Examples
MyScript
Files
- InnerSpace\Scripts\MyScript.XML
<DotNetScript> <References> <string>Lavish.InnerSpace.dll</string> </References> <SourceFiles> <string>MyScript\MyScript.cs</string> </SourceFiles> <Language>C#</Language> </DotNetScript>
- InnerSpace\Scripts\MyScript\MyScript.cs
using System; using System.Collections.Generic; using System.Text; using InnerSpaceAPI; namespace MyScript { class Program { static void Main(string[] args) { InnerSpace.Echo("Hello World! From MyScript.cs"); } } }
Executing
- Command
runscript myscript
- Output
Hello World! From MyScript.cs
YourScript.XML
<DotNetScript> <References> <string>Lavish.InnerSpace.dll</string> <string>Lavish.LavishNav.dll</string> </References> <SourceFiles> <string>YourScript\YourScript.cs</string> <string>YourScript\Widgets\Widget.cs</string> </SourceFiles> <Language>C#</Language> </DotNetScript>