Diesen Artikel finden Sie hier auch in deutscher Sprache.

One of the awesome new features in Biml is a new directive called "global"! It does exactly, what you would expect it to do: it allows you to add code to all or some of your Biml files at once.

Here is an example: This file with only 2 lines will make VB your default language across your entire solution!

<#@ global #>
<#@ template language="VB" #>

Another example: This one will simply add a comment on top of every Biml file:

<#@ global #>
<!-- Global Header -->

The global directive accepts up to 4 parameters, which are all optional, as they all have a default. Instead of calling it without any parameters, as we did in the 2 examples, both examples could also have looked like this without changing their behavior (except, they would now be in the same file):

<#@ global active="True" location="top" order="0" scope="Global" #>
<#@ template language="VB" #>
<!-- Global Header -->

The fact of them being in the same file shows, that there is no restriction on how much code you can put into a global file. You can use it to declare variables, add namespaces, import global includes or codefiles and much more.

As you can see, the parameters are:

1. Active
This is a simple boolean, allowing you to enable or disable a certain global file.

2. Location
This one accepts either "top" or "bottom" and defines if the content of that file is added at the beginning or the end of each file.

3. Order
As you can add multiple files using the global directive, this property actually allows you to bring them in order.

4. Scope
Scope is probably confusing for those working with BimlExpress rather than BimlStudio. BimlStudio easily allows you to work with directories etc. so this is where scope comes into play.

Options are:

– Global: Will be applied to all files
– Folder / FolderRecursive: Will only apply to all files within this folder or this folder incl. it’s subdirectories
– LogicalDisplayFolder / LogicalDisplayFolderRecursive: Same like Folder, except that it works for logical rather than physical folders
– Bundle / BundleExtension / Non Bundle: This only comes into play when you’re actually working with bundles, so we’ll spare you the details for now

5. applytocallbimlscript
Another boolean, controlling wheather the global file should also affect files being called using CallBimlScript. The default value is True!

Any questions or comments? We’d love to hear from you at !

Further Information on Biml in English can be found on our English Biml Page.

Happy Biml’ing!