version update history:
Update 3/18/04: Version 2.0.0.1
This version is so big that I want to refer to it as a major version number upgrade. The following is a list of fixes and improvements.
A app.config file is added to replace the option XML elements that are duplicated in the. dnml file, such as: Waitforuseraction, entry methods, scripting languages, and common reference assemblies. I also added the ability to add new languages to the scripting engine, so you can write. NET script files in any language, as long as the ' Codeprovider ' class of the language is defined (described in more detail later). The values defined in the app.config file are the same as machine configuration. That is, or, these basic values can be overridden by values in the Dnml file. The value in the DNML file has the highest priority, and it will be used by the scripting engine. But if your. dnml script file does not have any configuration defined, the values in the app.config file will be used. This allows you to define only the actual code in the. dnml file.
User Preference Configuration segment: A user preference segment is added to the app.config file. This section defines three configurations. Default language, script entry, and wait for user action flags. The default language is used to determine the language of the scripting language when there is no language element defined in the DNML file. A portal is a method that the script engine will invoke when the DNML file does not have an entry defined. The waitforuseraction tag is a Boolean value that determines whether the console window is retained after the script is finished and waits for a CRLF key to be pressed. If this is not defined in the DNML file, the value in the config file will be invoked by the scripting engine. Here is an example of this paragraph.
assembly Reference Configuration segment: This segment is used to define the assembly required for script execution. Any assembly defined in the segment is compiled at the time of each script run. Only the assembly name, not the full path name, is required. Here is an example of this paragraph.
Language Support configuration section: This section lets you dynamically add a new support language to the scripting engine without having to restart cheap engine code. The property name is the name defined in the DNML file, or the DefaultLanguage attribute in the user preference segment. A property assembly is an assembly full path name and file name that contains the Codeprovder implementation of the language. The property Codeprovidername is the code provider class of the language that contains the namespace of the name. Check out the Latebindcodeprovider () method of class Assemblygenerator to see how I added this functionality to the scripting engine.
Update 2/18/04: Version 1.0.2.0
I patched Charlie pointed out of the mentioned DotNetScriptEngine.exe registration. dnml file name extension associated with an error.
An optional entrypoint attribute has also been added for the DNML file format. This allows the user to specify an assembly entry instead of just the "Main" method. If the property entrypoint is populated with a method name, the method becomes the entry point. Otherwise, "Main" becomes the default assembly entry point.
Element language can be defined in the following three ways.
I also added an optional <waitForUserAction> element to the. DNML XML format. This is a new feature that allows you to keep the console window after the script has finished executing. Element waitforuseraction is optional. If it is not included in the. dnml file, the window will remain (open). The property value can be ' true ' or ' false '. If true, the window is preserved. If False, the console window closes immediately after the script has finished executing. This allows you to link several script files to a batch file. possible ways to use this element.
Finally, I added the. NET script back to the calling process, cmd or batch file, a value function that can be empty or an integer. There are now two ways to define the return value of a script entry method. You can define it as null, or you can define it as an integer value. If you use a null value, the script will not return anything. If you use an integer value, the script engine returns an integer value to the process that called it.
Examples of two different script entry methods: