CS-Script 3.20.0


Ignoring Namespaces



CS-Script is capable of resolving referenced in code namespaces (with using statements) into assembly file names and loading these assemblies automatically. However in some cases such resolving needs to be suppressed. The typical example of such scenario is a case when two versions of the assembly implementing the same namespace are present on PC in such case there is no warranty which one the script engine will find first. For such situations you may consider disabling resolving of a particular namespace and loading it's assembly explicitly.

This is the directive to ignore namespace during namespace-to-assembly resolving:

 //css_ignore_namespace <namespace>;

namespace - name of the namespace to be ignored

The shorter alias directive //css_ignore_ns can be used in place of the //css_ignore_namespace.


The following is the example which demonstrates how to prevent CS-Script from using default CSScriptLibrary.dll assembly and load different version of it CSScriptLibrary.v3.5.dll.

//css_reference CSScriptLibrary.v3.5.dll; 
//css_ignore_ns CSScriptLibrary; 
using System;
using CSScriptLibrary;

public class Host
{
  ....

It //css_ignore_ns was not present in the code the script engine would resolve using CSScriptLibrary into CSScriptLibrary.dll. //css_ignore_ns directive simply excludes CSScriptLibrary namespace from resolving and allows developer to load desired assembly explicitly (//css_reference CSScriptLibrary.v3.5.dll;).

Note: a single '//css_ignore_ns *' directive completle disables any resolving of name spaces.


See Also

Using .NET assemblies