• HOME
  • PRODUCTS
  • DEMOS
  • BUY
  • BLOG
  • FORUM
  • DOCUMENTATION
  • ABOUT
  • FREE EVALUATION
Search Results for

    Show / Hide Table of Contents

    ScriptSource Property

    ScriptSource

    Gets source of the script to execute.

    Declaration
    [Browsable(false)]
    public IScriptSource ScriptSource { get; }
    Property Value
    Type Description
    IScriptSource
    Implements
    IScriptRun.ScriptSource
    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.

    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
    
    In This Article
    Back to top Copyright AlterNET Software Download PDF