JScript .NET, Part III: Classes and Namespaces
When you specify
/autoref- at the
jsc.exe compilation command, there is no automatic association between namespaces and assemblies. You need to specify the assembly names explicitly. Use the
/reference switch to do this. The syntax is simple:
Since only one
.exe file can be associated with a single application, your assemblies should be
.dll files. In any case, when you compile with
/target:exe, do not pass to the
/reference switch any assemblies created with
When you reference an Assembly A which references another assembly (B), you may need to reference Assembly B as well, if Assembly B inherits from Assembly A, or if Assembly A implements an interface from Assembly B.
In order for the compiler to recognize types in an assembly, it needs to resolve these types first. You need to force the compiler to resolve these types by creating instances of these types, or by inheriting from these types.
Here is an example for using the
jsc /reference:metad1.dll;metad2.dll /out:out.exe input.js
The compiler searches for the assembly in the following order:
- Current working directory, from where the compiler is invoked.
- The common language runtime system directory.
- Directories specified by
- Directories specified by the
Here is an example using
jsc /lib:c:\ /reference:t2.dll t2.js
Next: How to specify member visibility