5

I have an F# script that I intend to use both at home and at work. The script shall work similarly in both places, yet, I have a set of issues to deal with at work (mostly regarding firewalls and http proxies) so I'd like to run my script in a slightly different way in one case and in the other.

I imagine that ideally I'd set a special flag (directive) at the FSI level, so I could have #if AT_WORK to deal with some sharp corner cases.

How to accomplish this?

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
devoured elysium
  • 101,373
  • 131
  • 340
  • 557

1 Answers1

8

Yes, you can define your own symbols to use with conditional compilation, when you call FSI do it like this:

Fsi.exe --define:AT_WORK yourScript.fsx

See http://msdn.microsoft.com/en-us/library/dd233172.aspx

Gus
  • 25,839
  • 2
  • 51
  • 76