IVsaEngine.RootNamespace Property

Sets or gets the root namespace used by the script engine.

public: __property String* get_RootNamespace(); 
public: __property void set_RootNamespace(String* value);
public string RootNamespace {get; set;}
Property Get RootNamespace() As String 
Public Property Let RootNamespace(ByVal value As String)

Return Value

Returns the string value of the root namespace.

Remarks

Although the RootNamespace property can be set at any time, specific circumstances require that it must be set:

  • When the IVsaEngine.Compile method is called.

  • When the IVsaEngine.Run method is called, so that the runtime loader engine can find the startup class.

This property is initially set to the empty string. However, it must be set to a valid namespace identifier before calling the IVsaEngine.Compile method. The host must set the proper RootNamespace property value for a script engine before it can run customization code.

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

Exception Type

Condition

EngineClosed

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

EngineBusy

The engine is currently executing code for another thread.

EngineNotInitialized

The engine has not been initialized.

EngineRunning

The engine is currently running.

NamespaceInvalid

An invalid namespace was specified which contains illegal characters.

Example

The following example shows how to set the RootNamespace property of the engine to the string "MyApp.MyNamespace":

// Set the root namespace and compile.
myEngine.RootNamespace = "MyApp.MyNamespace";
myEngine.Compile();

See Also

Reference

IVsaEngine Interface

IVsaEngine.Compile Method

IVsaSite.GetCompiledState Method