IVsaEngine.SetOption Method
Sets implementation-specific options for a script engine.
public: void SetOption(
String* Name,
Object* value
);
public void SetOption(
string Name,
object value
);
MustOverride Public Sub SetOption( _
ByVal Name As String, _
ByVal value As Object _
)
Parameters
name
The name of the option to set.value
The value for the option being set.
Remarks
An example of such an implementation-specific option would be compiler-specific switches passed in to the script engine, for example to turn warnings into exceptions.
The following table shows available options for the JScript .NET script engine. The table lists all JScript compiler options, even those that are not supported by Script for the .NET Framework runtime scenarios. The latter are marked with an asterisk (*). While these options can be set and changed using the JScript command-line compiler, they should not be used because they can disrupt Visual Studio for Applications functionality.
Option |
Type |
Description |
---|---|---|
AlwaysGenerateIL |
Boolean Get/Set |
Setting to true enables error-recovery. JScript .NET will attempt to build an assembly that runs, even if there are compiler errors. |
CLSCompliant |
Boolean Get/Set |
Forces checks for compliance to the Common Language Specification (CLS). |
DebugDirectory |
String Get/Set |
Specifies the directory to which JScript .NET will store source code items from which they can be loaded into a debugger. Used when the IVsaEngine.GenerateDebugInfo property is set to true. |
Define |
Not applicable |
Ignored. |
Defines |
Hashtable Get/Set |
Defines pre-processor name-value pairs. Value must be numeric or Boolean constant. |
EE* |
Boolean Get/Set |
Reserved for the debugger. |
Fast |
Boolean Get/Set |
Enables fast mode. |
LibPath* |
String Get/Set |
Specifies path to libraries. Multiple directories should be separated with System.IO.Path.DirectorySeparatorChar. |
ManagedResources |
ICollection Get/Set |
Specifies managed resources to embed into the assembly. Items in the collection must be Microsoft.JScript.Vsa.ResInfo objects. |
Optimize |
Not applicable |
Ignored. |
Output* |
String Get/Set |
Specifies the name of the output file. |
PEFileKind* |
System.Reflection. Emit.PEFileKinds Get/Set |
Specifies the desired type of output (for example, EXE, DLL, WinEXE files). |
Boolean Get/Set |
Enables the print function. Set Microsoft.JScript.ScriptStream.Out to an instance of Text Writer to receive the output. |
|
UseContextRelativeStatics |
Boolean Get/Set |
Makes global variables context-relative, improving thread-safety at the expense of performance. Avoid global variables in multi-threaded environments. |
Version* |
System.Version Get/Set |
Provides version information for the assembly. |
VersionSafe |
Boolean Get/Set |
Forces user to write version-safe code. |
WarnAsError |
Boolean Get/Set |
Directs compiler to treat warnings as errors. |
WarningLevel |
Int Get/Set |
Specifies level of warnings to report, from 0 (errors) to 4 (least severe). |
Win32Resource |
String Get/Set |
Specifies name of Win32 resource file to embed. |
The following table lists available options for the Visual Basic .NET script engine.
Option |
Type |
Description |
---|---|---|
AppDomain |
String Get/Set |
Sets or retrieves the application domain in which a script engine executes compiled code when it calls the IVsaEngine.Run method. The option enables you to specify the AppDomain in which the code will run, or to create a new AppDomain, if one is needed. To create a new AppDomain in which to run code, the host should pass null for the pDomain parameter. |
ApplicationBase |
String Get/Set |
Sets or retrieves the ApplicationBase directory. All assemblies that are referenced by a project, but that are not part of the Microsoft .NET Framework, must be placed in the ApplicationBase directory. |
ClientDebug |
Boolean Get/Set |
Specifies whether client debugging is enabled. Supported in the design-time engine only. |
HostName |
String Get/Set |
Specifies the literal name of the host that is used in the IDE for the Return to <host> command. |
TargetExe |
String Get/Set |
The path for the application that should be launched when the client debugging session is begun. The host can set this option if a new instance of the target application should be launched each time the debugging session is started. |
TargetExeArguments |
String Get/Set |
Arguments that the host can pass to the application specified with the TargetEXE option. The host can use this property to pass command line arguments, if needed. |
TargetPID |
Int (unsigned) Get/Set |
Specifies the process ID (PID) for the application to which the debugger should be attached. The host can use this property to attach the debugger to an application that is currently running, rather than launching a new instance of the target application. The host is responsible for determining the correct PID for the running instance of the application. |
TargetExeStartupDirectory |
String Get/Set |
Specifies the startup directory for the application that is launched with a new debugging session is started. |
The following table shows the exceptions that the SetOption method 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. |
OptionInvalid |
The new value specified for the option is not valid. |
OptionNotSupported |
The specified option is not supported by the engine. |