Share via


IVsaEngine.Assembly Property

Gets a reference to the running assembly generated by the IVsaEngine.Run method.

public: __property Assembly* get_Assembly();
public Assembly Assembly {get;}
Public Property Get Assembly() As Assembly

Return Value

Reference to the currently running assembly.

Remarks

The host can use the value of this property to manipulate the assembly while the script engine is running.

You should release references to the assembly or types within the assembly before initiating any operation that will cause the assembly to be torn down, such as calling the IVsaEngine.Reset or IVsaEngine.Compile methods.

The following table shows the exceptions that the Assembly property can throw.

Exception Type

Condition

EngineClosed

The IVsaEngine.Close method has been called and the engine is closed.

EngineNotRunning

The engine is not running, so no assembly is available.

EngineBusy

The engine is currently executing code for another thread.

Example

The following example shows how to create an instance of a class contained in the assembly generated by the script engine.

// The script engine must be in the running state
// to get the assembly.
myEngine.Run();

// Create an instance of a class in that assembly.
var myObj = myEngine.Assembly.CreateInstance(""MyClass"");

// Use the class.
myObj.DoSomething();

See Also

Reference

IVsaEngine Interface

IVsaEngine.Run Method

IVsaEngine.IsRunning Property