Click or drag to resize

IEvaluatorCompileAssemblyFromCode Method

Compiles C# code (script) into assembly file. The C# code is a typical C# code containing a single or multiple class definition(s).

Namespace:  CSScriptLib
Assembly:  CSScriptLib (in CSScriptLib.dll) Version: 1.3.2.0
Syntax
C#
string CompileAssemblyFromCode(
	string scriptText,
	string outputFile
)

Parameters

scriptText
Type: SystemString
The C# script text.
outputFile
Type: SystemString
The path to the assembly file to be compiled.

Return Value

Type: String
The compiled assembly file path.
Examples
string asmFile = CSScript.Evaluator
                         .CompileAssemblyFromCode(
                                @"using System;
                                  public class Script
                                  {
                                      public int Sum(int a, int b)
                                      {
                                          return a+b;
                                      }
                                  }",
                                  "MyScript.dll");
See Also