cobra -lib:'{EnvironmentVar}\...\{@latest}'
Posted: Sat Nov 30, 2013 8:58 pm
I have enhanced the -lib option to take environment variables as well as the special variable {@latest}. Here is a real example used for Windows Presentation Foundation (WPF) which was the main inspiration for this:
As you can see from the example you can actually have more than one env var separated by vertical bars: {foo|bar|baz}
The first path that actually exists on disk at the time of compilation "wins". Then {@latest} can be used to distinguish between directories like "v4.0", "v4.5" and "v4.5.1". The "v" prefix is optional.
Those of you who run the compiler test suite shouldn't see any more WPF errors. If you do, let me know.
For everyone: If you have problems with this, let me know here. If you come up with other uses for it besides WPF, please share in this thread.
- Code: Select all
# at the command line:
cobra -lib:'{ProgramFiles|ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\{@latest}' foo.cobra ...
# or you can put it in your source code with @args:
@args lib:'{ProgramFiles|ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\{@latest}'
@ref 'WindowsBase'
@ref 'PresentationCore'
@ref 'PresentationFramework'
@ref 'System.Xaml'
use System.Windows
use System.Windows.Media
# ...
As you can see from the example you can actually have more than one env var separated by vertical bars: {foo|bar|baz}
The first path that actually exists on disk at the time of compilation "wins". Then {@latest} can be used to distinguish between directories like "v4.0", "v4.5" and "v4.5.1". The "v" prefix is optional.
Those of you who run the compiler test suite shouldn't see any more WPF errors. If you do, let me know.
For everyone: If you have problems with this, let me know here. If you come up with other uses for it besides WPF, please share in this thread.