This documentation is archived and is not being maintained.

IVsaEngine.Assembly Property

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

[Visual Basic]
ReadOnly Property Assembly As Assembly
[C#]
Assembly Assembly {get;}
[C++]
__property Assembly* get_Assembly();
[JScript]
function get Assembly() : Assembly;

Property 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();

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IVsaEngine Interface | IVsaEngine Members | Microsoft.Vsa Namespace | IVsaEngine.Run | IVsaEngine.IsRunning

Show: