Table of Contents

Property ScriptSource

Namespace
Alternet.Scripter
Assembly
Alternet.Scripter.v9.dll

ScriptSource

Gets source of the script to execute.

[Browsable(false)]
public IScriptSource ScriptSource { get; }

Property Value

IScriptSource

Examples

Here is how to use a ScriptSource in the C# code:

using Alternet.Scripter;

public partial class Form1 : Form
{
    private ScriptRun scriptRun;
    private void Form1_Load(object sender, EventArgs e)
    {
        scriptRun = new ScriptRun();
        scriptRun.ScriptSource.SearchPaths.Add(@"D:\References\");
        scriptRun.ScriptSource.FromScriptCode(edit.Text);
        scriptRun.ScriptSource.WithDefaultReferences();
        scriptRun.ScriptSource.References.Add("ExternalAssembly");
        scriptRun.AssemblyKind = ScriptAssemblyKind.DynamicLibrary;
    }
}

Here is how to use a ScriptSource in the Visual Basic code:

Imports Alternet.Scripter

Partial Public Class Form1
    Inherits Form

    Private scriptRun As ScriptRun

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        scriptRun = New ScriptRun()
        scriptRun.ScriptSource.SearchPaths.Add("D:\References\")
        scriptRun.ScriptSource.FromScriptCode(edit.Text)
        scriptRun.ScriptSource.WithDefaultReferences()
        scriptRun.ScriptSource.References.Add("ExternalAssembly")
        scriptRun.AssemblyKind = ScriptAssemblyKind.DynamicLibrary
    End Sub
End Class

Remarks

ScriptSource specifies that the script to be executed is a simple code, list of files or entire Visual-Studio project.

Use ScriptSource to specify additional information related to the script compilation, such as search directories to look for the source files and referenced assemblies.