Skip to content

Configuration Files

kevingadd edited this page Apr 14, 2012 · 25 revisions

JSILc allows you to control translation of your applications and libraries by providing one or more JSIL Configuration Files with the extension .jsilconfig.

Where JSILc finds configuration files

  • JSILc will automatically load any .jsilconfig files you pass it on the command line and apply them to all files translated during that session.
  • JSILc will search next to each .sln file translated for a matching .jsilconfig file: Foo.sln.jsilconfig. This configuration file will affect only that solution and its outputs.
  • JSILc will search next to each .exe or .dll file translated for a matching .jsilconfig file: Foo.dll.jsilconfig. This configuration file will affect that assembly and its dependencies. Note that this only works for assemblies being translated directly; you cannot set per-assembly configuration for dependencies.
  • A file named defaults.jsilconfig is automatically placed in the JSILc bin folder during the compile process. This file will be automatically loaded and applied during translation unless disabled (see ApplyDefaults below).

Configuration file format

A configuration file is a single JSON dictionary. The dictionary can contain the following setting keys:

Key Type Default Value Description
ApplyDefaults Boolean true If true, the default project settings will be applied from defaults.jsilconfig. Note that default project settings never override settings you have specified yourself.
Assemblies Dictionary See the 'Assembly Settings' section below.
FrameworkVersion Float automatic Allows you to specify which version of the .NET framework your application uses. Currently, JSILc only supports 3.5 and 4.0.
GenerateSkeletonsForStubbedAssemblies Boolean false If true, any stubbed assemblies translated will be produced as a 'skeleton', where the class definitions are replaced with JSIL.ImplementExternals calls and each method body is replaced with a throw statement. These skeletons can easily be copy-pasted to create your own JavaScript implementation of .NET libraries.
IncludeDependencies Boolean true If true, any assembly loaded for translation will be automatically scanned for dependent assemblies, and those dependent assemblies will be loaded and translated with it. This is necessary in order to produce working JavaScript, but you can disable it if you are certain that none of the dependent assemblies' types or functions are used.
Optimizer Dictionary See the 'Optimizer Settings' section below.
UseSymbols Boolean true If true, JSILc will search for .pdb/.mdb symbols for each loaded assembly, and use variable names from the symbols to improve the quality of the output JavaScript.
UseThreads Boolean true If true, JSILc will attempt to use multiple threads for translation. This typically provides a 25-50% speedup per-core when decompiling .NET assemblies and optimizing output JavaScript. Note, however, that this may increase memory usage or cause you to hit bugs in the compiler, so you may wish to try turning it off if you run into problems.
Clone this wiki locally